Merge branch 'main' into feature/dialogue-frontend

This commit is contained in:
Cat Flynn 2021-02-22 10:33:36 +00:00
commit 955972e4a3
24 changed files with 617 additions and 8 deletions

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: f40cf77e2ef30fe4f8a89d5e5d5ee51e
guid: daa7df1d74482674f9d3277a44cd93bd
folderAsset: yes
DefaultImporter:
externalObjects: {}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 8ba1397828f5976449e5413e38108cfd
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,224 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &8781564213167799763
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 8781564213167799764}
- component: {fileID: 8781564213167799767}
- component: {fileID: 8781564213167799766}
- component: {fileID: 8781564213167799761}
- component: {fileID: 8781564214016862072}
m_Layer: 0
m_Name: Artefact
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &8781564213167799764
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8781564213167799763}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -1.38, y: 0.5, z: 38.53155}
m_LocalScale: {x: 0.5, y: 0.5, z: 0.5}
m_Children:
- {fileID: 8781564214893312960}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!33 &8781564213167799767
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8781564213167799763}
m_Mesh: {fileID: 10206, guid: 0000000000000000e000000000000000, type: 0}
--- !u!23 &8781564213167799766
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8781564213167799763}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 31321ba15b8f8eb4c954353edc038b1d, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_AdditionalVertexStreams: {fileID: 0}
--- !u!136 &8781564213167799761
CapsuleCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8781564213167799763}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
m_Radius: 0.5000001
m_Height: 2
m_Direction: 1
m_Center: {x: 0.000000059604645, y: 0, z: -0.00000008940697}
--- !u!114 &8781564214016862072
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8781564213167799763}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 7d3ed39e75807bc4d865f39b2ef9ea69, type: 3}
m_Name:
m_EditorClassIdentifier:
data: {fileID: 0}
_nearbyArtefactID: {fileID: 11400000, guid: caba70196fbb1c549a934f7566f7a247, type: 2}
--- !u!1 &8781564214893312975
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 8781564214893312960}
- component: {fileID: 8781564214893312963}
- component: {fileID: 8781564214893312962}
- component: {fileID: 8781564214893312973}
- component: {fileID: 8781564214893312972}
m_Layer: 0
m_Name: Sphere
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &8781564214893312960
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8781564214893312975}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 2, y: 2, z: 2}
m_Children: []
m_Father: {fileID: 8781564213167799764}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!33 &8781564214893312963
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8781564214893312975}
m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0}
--- !u!23 &8781564214893312962
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8781564214893312975}
m_Enabled: 0
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 31321ba15b8f8eb4c954353edc038b1d, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_AdditionalVertexStreams: {fileID: 0}
--- !u!135 &8781564214893312973
SphereCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8781564214893312975}
m_Material: {fileID: 0}
m_IsTrigger: 1
m_Enabled: 1
serializedVersion: 2
m_Radius: 4
m_Center: {x: 0, y: 0, z: 0}
--- !u!114 &8781564214893312972
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8781564214893312975}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 44966bb2b773ce145a9d6c7c9f42aeba, type: 3}
m_Name:
m_EditorClassIdentifier:
_nearbyArtefactID: {fileID: 11400000, guid: caba70196fbb1c549a934f7566f7a247, type: 2}
_artefact: {fileID: 8781564214016862072}

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 2dae894ec500e524a88f985657f9682d
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -95,6 +95,7 @@ GameObject:
- component: {fileID: 13726836969441780}
- component: {fileID: 13726836969441782}
- component: {fileID: 13726837176080779}
- component: {fileID: 3320306143821152633}
m_Layer: 0
m_Name: Player
m_TagString: Untagged
@ -282,6 +283,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: e12816fc78a8ca3429be019aa4e51fdd, type: 3}
m_Name:
m_EditorClassIdentifier:
_nearbyArtefactID: {fileID: 11400000, guid: caba70196fbb1c549a934f7566f7a247, type: 2}
_inputSettings: {fileID: 11400000, guid: 09b165d6ce14f86459be7213da9688a7, type: 2}
--- !u!114 &13726837176080779
MonoBehaviour:
@ -299,6 +301,18 @@ MonoBehaviour:
_cheatBoost: 0
_blink: {fileID: 11400000, guid: b47ea197a7cc2ed4eb15271cef672997, type: 2}
_boost: {fileID: 11400000, guid: d5ed942937d8cca478f3ec97f6b9c8a2, type: 2}
--- !u!114 &3320306143821152633
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 13726836969441781}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 005bf73dff204914c9e1bbd60c843451, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &13726837293638831
GameObject:
m_ObjectHideFlags: 0

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 769687da190b8df4d9b78745674ad9aa
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,19 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[CreateAssetMenu(fileName = "New Artefact", menuName = "Artefact", order = 51)]
public class Artefact : ScriptableObject
{
public int artefactID => _artefactID;
[SerializeField] private int _artefactID;
public string artefactDialogue => _artefactDialogue;
[SerializeField] private string _artefactDialogue;
public bool show => _show;
private bool _show = false;
public bool canInteract => _canInteract;
private bool _canInteract = false;
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e26cf8dbdb474db49ac6dadf49ceade2
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,84 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Ktyl.Util;
public class ArtefactControl : MonoBehaviour
{
private bool _show;
private bool _canInteract;
[SerializeField]
private Artefact data;
public int artefactID => _artefactID;
private int _artefactID;
private string _artefactDialogue;
[SerializeField] private SerialInt _nearbyArtefactID;
private void Start()
{
_artefactID = data.artefactID;
_artefactDialogue = data.artefactDialogue;
_show = data.show;
_canInteract = data.canInteract;
EventHandler.current.onArtefactTriggerEnter += NearArtefact;
EventHandler.current.onArtefactTriggerExit += AwayArtefact;
EventHandler.current.onArtefactPickUp += PickUp;
}
private void NearArtefact(int id)
{
if (id == this._artefactID)
{
_show = true;
this._canInteract = true;
}
}
private void AwayArtefact(int id)
{
if (id == this._artefactID)
{
_show = false;
this._canInteract = false;
}
}
private void PickUp(int id)
{
if (id == this._artefactID)
{
if (_canInteract == true)
{
ArtefactInventory.addA(data);
foreach (var x in ArtefactInventory.artefactList)
{
Debug.Log(x.ToString());
}
}
//here put 'show artifact dialogue'
if (this.gameObject != null)
Destroy(this.gameObject);
_nearbyArtefactID.Value = -1;
//PlayerInputHandler.id = 0;
}
}
void OnGUI()
{
if (_show)
{
GUI.Label(new Rect(Screen.width / 2 - 50, 5, 100, 100), "Press E to pickup");
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 7d3ed39e75807bc4d865f39b2ef9ea69
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,29 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ArtefactInventory : ScriptableObject
{
public static List<Artefact> artefactList = new List<Artefact>();
private static bool exists = false;
public static void addA(Artefact a)
{
//check if duplicate in the list
exists = false;
foreach (Artefact x in artefactList)
{
if (x.artefactID == a.artefactID)
exists = true;
}
if ( exists == false)
{
artefactList.Add(a);
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 6be0ffc922ae4ac4cb7568e04674a61c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 73c4cfa51bc2a6b40810cb5b784f15a8
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,16 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: e26cf8dbdb474db49ac6dadf49ceade2, type: 3}
m_Name: Artefact1
m_EditorClassIdentifier:
_artefactID: 1
_artefactDialogue:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 38f76e60d5df1d445a455c63a88da8e1
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,16 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: e26cf8dbdb474db49ac6dadf49ceade2, type: 3}
m_Name: Artefact2
m_EditorClassIdentifier:
_artefactID: 2
_artefactDialogue:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 4c18fa3513891124282e56285b09c211
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,27 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Ktyl.Util;
public class ArtefactTriggerArea : MonoBehaviour
{
[SerializeField] private SerialInt _nearbyArtefactID;
[SerializeField] private ArtefactControl _artefact;
private int id => _artefact.artefactID;
private void OnTriggerEnter(Collider Player)
{
EventHandler.current.ArtefactTriggerEnter(id);
//PlayerInputHandler.id = _id;
_nearbyArtefactID.Value = id;
}
private void OnTriggerExit(Collider Player)
{
EventHandler.current.ArtefactTriggerExit(id);
//PlayerInputHandler.id = 0;
_nearbyArtefactID.Value = -1;
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 44966bb2b773ce145a9d6c7c9f42aeba
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,45 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class EventHandler : MonoBehaviour
{
public static EventHandler current;
private void Awake()
{
current = this;
}
public event Action<int> onArtefactTriggerEnter;
public void ArtefactTriggerEnter(int id)
{
if (onArtefactTriggerEnter != null)
{
onArtefactTriggerEnter(id);
}
}
public event Action<int> onArtefactTriggerExit;
public void ArtefactTriggerExit(int id)
{
if (onArtefactTriggerExit != null)
{
onArtefactTriggerExit(id);
}
}
public event Action<int> onArtefactPickUp;
public void ArtefactPickUp(int id)
{
if (onArtefactPickUp != null)
{
onArtefactPickUp(id);
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 005bf73dff204914c9e1bbd60c843451
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,16 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: cc38ab5b9e594a344a8eb1635487d5eb, type: 3}
m_Name: nearbyArtefactID
m_EditorClassIdentifier:
_initialValue: 0
_readOnly: 0

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: caba70196fbb1c549a934f7566f7a247
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -3,9 +3,13 @@ using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.InputSystem;
using Ktyl.Util;
public class PlayerInputHandler : MonoBehaviour
{
//to get the artifact id you are near to
[SerializeField] private SerialInt _nearbyArtefactID;
[SerializeField]
private PlayerInputSettings _inputSettings;
@ -69,5 +73,10 @@ public class PlayerInputHandler : MonoBehaviour
=> _state.Jump.Set( context.ReadValueAsButton() );
public void Use(InputAction.CallbackContext context)
=> _state.Use.Set( context.ReadValueAsButton() );
{
_state.Use.Set( context.ReadValueAsButton() );
if(context.started)
EventHandler.current.ArtefactPickUp(_nearbyArtefactID.Value);
}
}