trigger dialogue on artefact pickup
This commit is contained in:
parent
35d652bb95
commit
e47f04fb79
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: d2764ab4e4dca7a45b1067df7aab2588
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -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: d089d711384390948a578301b55b65f9, type: 3}
|
||||
m_Name: Artefact System
|
||||
m_EditorClassIdentifier:
|
||||
_dialogue: {fileID: 11400000, guid: 56369c4e83cc59e44bf55cd16fafc4e8, type: 2}
|
||||
_inventory: {fileID: 11400000, guid: 1a9441435aa1fc649a84169f689c7f53, type: 2}
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: f523ac0d77530064b8b41c627b13fae0
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -13,4 +13,4 @@ MonoBehaviour:
|
|||
m_Name: Artefact1
|
||||
m_EditorClassIdentifier:
|
||||
_artefactID: 1
|
||||
_artefactDialogue:
|
||||
_dialogueKey: ARTEFACT_0_0
|
|
@ -13,4 +13,4 @@ MonoBehaviour:
|
|||
m_Name: Artefact2
|
||||
m_EditorClassIdentifier:
|
||||
_artefactID: 2
|
||||
_artefactDialogue:
|
||||
_dialogueKey: ARTEFACT_1_0
|
|
@ -0,0 +1,14 @@
|
|||
%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: 6be0ffc922ae4ac4cb7568e04674a61c, type: 3}
|
||||
m_Name: Inventory
|
||||
m_EditorClassIdentifier:
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 1a9441435aa1fc649a84169f689c7f53
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -1,5 +1,86 @@
|
|||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &1085328826835407779
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 2663749718261374877}
|
||||
- component: {fileID: 2205831332405259923}
|
||||
- component: {fileID: 8272008737841710381}
|
||||
m_Layer: 0
|
||||
m_Name: Cylinder
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &2663749718261374877
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1085328826835407779}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0.05, z: 0}
|
||||
m_LocalScale: {x: 0.1, y: 0.1, z: 0.1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 8781564213167799764}
|
||||
m_RootOrder: 1
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!33 &2205831332405259923
|
||||
MeshFilter:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1085328826835407779}
|
||||
m_Mesh: {fileID: 10206, guid: 0000000000000000e000000000000000, type: 0}
|
||||
--- !u!23 &8272008737841710381
|
||||
MeshRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1085328826835407779}
|
||||
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!1 &8781564213167799763
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -28,10 +109,11 @@ Transform:
|
|||
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_LocalPosition: {x: 0, y: 0.5, z: 0}
|
||||
m_LocalScale: {x: 0.5, y: 0.5, z: 0.5}
|
||||
m_Children:
|
||||
- {fileID: 8781564214893312960}
|
||||
- {fileID: 2663749718261374877}
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
|
@ -50,7 +132,7 @@ MeshRenderer:
|
|||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 8781564213167799763}
|
||||
m_Enabled: 1
|
||||
m_Enabled: 0
|
||||
m_CastShadows: 1
|
||||
m_ReceiveShadows: 1
|
||||
m_DynamicOccludee: 1
|
||||
|
@ -93,7 +175,7 @@ CapsuleCollider:
|
|||
m_GameObject: {fileID: 8781564213167799763}
|
||||
m_Material: {fileID: 0}
|
||||
m_IsTrigger: 0
|
||||
m_Enabled: 1
|
||||
m_Enabled: 0
|
||||
m_Radius: 0.5000001
|
||||
m_Height: 2
|
||||
m_Direction: 1
|
||||
|
@ -112,6 +194,7 @@ MonoBehaviour:
|
|||
m_EditorClassIdentifier:
|
||||
data: {fileID: 0}
|
||||
_nearbyArtefactID: {fileID: 11400000, guid: caba70196fbb1c549a934f7566f7a247, type: 2}
|
||||
_artefacts: {fileID: 11400000, guid: f523ac0d77530064b8b41c627b13fae0, type: 2}
|
||||
--- !u!1 &8781564214893312975
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -141,7 +224,7 @@ Transform:
|
|||
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_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 8781564213167799764}
|
||||
m_RootOrder: 0
|
||||
|
|
|
@ -957,6 +957,79 @@ MeshFilter:
|
|||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1549487653}
|
||||
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
|
||||
--- !u!1001 &1580220236
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 2
|
||||
m_Modification:
|
||||
m_TransformParent: {fileID: 0}
|
||||
m_Modifications:
|
||||
- target: {fileID: 8781564213167799763, guid: 2dae894ec500e524a88f985657f9682d, type: 3}
|
||||
propertyPath: m_Name
|
||||
value: Artefact 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8781564213167799764, guid: 2dae894ec500e524a88f985657f9682d, type: 3}
|
||||
propertyPath: m_RootOrder
|
||||
value: 5
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8781564213167799764, guid: 2dae894ec500e524a88f985657f9682d, type: 3}
|
||||
propertyPath: m_LocalScale.x
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8781564213167799764, guid: 2dae894ec500e524a88f985657f9682d, type: 3}
|
||||
propertyPath: m_LocalScale.y
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8781564213167799764, guid: 2dae894ec500e524a88f985657f9682d, type: 3}
|
||||
propertyPath: m_LocalScale.z
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8781564213167799764, guid: 2dae894ec500e524a88f985657f9682d, type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: -5.31
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8781564213167799764, guid: 2dae894ec500e524a88f985657f9682d, type: 3}
|
||||
propertyPath: m_LocalPosition.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8781564213167799764, guid: 2dae894ec500e524a88f985657f9682d, type: 3}
|
||||
propertyPath: m_LocalPosition.z
|
||||
value: 6.65
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8781564213167799764, guid: 2dae894ec500e524a88f985657f9682d, type: 3}
|
||||
propertyPath: m_LocalRotation.w
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8781564213167799764, guid: 2dae894ec500e524a88f985657f9682d, type: 3}
|
||||
propertyPath: m_LocalRotation.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8781564213167799764, guid: 2dae894ec500e524a88f985657f9682d, type: 3}
|
||||
propertyPath: m_LocalRotation.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8781564213167799764, guid: 2dae894ec500e524a88f985657f9682d, type: 3}
|
||||
propertyPath: m_LocalRotation.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8781564213167799764, guid: 2dae894ec500e524a88f985657f9682d, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8781564213167799764, guid: 2dae894ec500e524a88f985657f9682d, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8781564213167799764, guid: 2dae894ec500e524a88f985657f9682d, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8781564214016862072, guid: 2dae894ec500e524a88f985657f9682d, type: 3}
|
||||
propertyPath: data
|
||||
value:
|
||||
objectReference: {fileID: 11400000, guid: 38f76e60d5df1d445a455c63a88da8e1, type: 2}
|
||||
m_RemovedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: 2dae894ec500e524a88f985657f9682d, type: 3}
|
||||
--- !u!1 &1708945667
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -1052,6 +1125,79 @@ MeshFilter:
|
|||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1708945667}
|
||||
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
|
||||
--- !u!1001 &1751696412
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 2
|
||||
m_Modification:
|
||||
m_TransformParent: {fileID: 0}
|
||||
m_Modifications:
|
||||
- target: {fileID: 8781564213167799763, guid: 2dae894ec500e524a88f985657f9682d, type: 3}
|
||||
propertyPath: m_Name
|
||||
value: Artefact 2
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8781564213167799764, guid: 2dae894ec500e524a88f985657f9682d, type: 3}
|
||||
propertyPath: m_RootOrder
|
||||
value: 6
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8781564213167799764, guid: 2dae894ec500e524a88f985657f9682d, type: 3}
|
||||
propertyPath: m_LocalScale.x
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8781564213167799764, guid: 2dae894ec500e524a88f985657f9682d, type: 3}
|
||||
propertyPath: m_LocalScale.y
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8781564213167799764, guid: 2dae894ec500e524a88f985657f9682d, type: 3}
|
||||
propertyPath: m_LocalScale.z
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8781564213167799764, guid: 2dae894ec500e524a88f985657f9682d, type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: -5.23
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8781564213167799764, guid: 2dae894ec500e524a88f985657f9682d, type: 3}
|
||||
propertyPath: m_LocalPosition.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8781564213167799764, guid: 2dae894ec500e524a88f985657f9682d, type: 3}
|
||||
propertyPath: m_LocalPosition.z
|
||||
value: 2.22
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8781564213167799764, guid: 2dae894ec500e524a88f985657f9682d, type: 3}
|
||||
propertyPath: m_LocalRotation.w
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8781564213167799764, guid: 2dae894ec500e524a88f985657f9682d, type: 3}
|
||||
propertyPath: m_LocalRotation.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8781564213167799764, guid: 2dae894ec500e524a88f985657f9682d, type: 3}
|
||||
propertyPath: m_LocalRotation.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8781564213167799764, guid: 2dae894ec500e524a88f985657f9682d, type: 3}
|
||||
propertyPath: m_LocalRotation.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8781564213167799764, guid: 2dae894ec500e524a88f985657f9682d, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8781564213167799764, guid: 2dae894ec500e524a88f985657f9682d, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8781564213167799764, guid: 2dae894ec500e524a88f985657f9682d, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8781564214016862072, guid: 2dae894ec500e524a88f985657f9682d, type: 3}
|
||||
propertyPath: data
|
||||
value:
|
||||
objectReference: {fileID: 11400000, guid: 4c18fa3513891124282e56285b09c211, type: 2}
|
||||
m_RemovedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: 2dae894ec500e524a88f985657f9682d, type: 3}
|
||||
--- !u!224 &1894783044 stripped
|
||||
RectTransform:
|
||||
m_CorrespondingSourceObject: {fileID: 5119468870989674483, guid: fde30a46065b3b144ac612ec0b3e484a, type: 3}
|
||||
|
|
|
@ -2,14 +2,13 @@ using System.Collections;
|
|||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
[CreateAssetMenu(fileName = "New Artefact", menuName = "Artefact", order = 51)]
|
||||
[CreateAssetMenu(fileName = "New Artefact", menuName = "KernelPanic/Artefacts/Artefact")]
|
||||
public class Artefact : ScriptableObject
|
||||
{
|
||||
|
||||
public int artefactID => _artefactID;
|
||||
[SerializeField] private int _artefactID;
|
||||
public string artefactDialogue => _artefactDialogue;
|
||||
[SerializeField] private string _artefactDialogue;
|
||||
public string dialogueKey => _dialogueKey;
|
||||
[SerializeField] private string _dialogueKey;
|
||||
|
||||
public bool show => _show;
|
||||
private bool _show = false;
|
||||
|
|
|
@ -2,6 +2,7 @@ using System.Collections;
|
|||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using Ktyl.Util;
|
||||
using UnityEngine.Events;
|
||||
|
||||
public class ArtefactControl : MonoBehaviour
|
||||
{
|
||||
|
@ -14,13 +15,13 @@ public class ArtefactControl : MonoBehaviour
|
|||
private Artefact data;
|
||||
public int artefactID => _artefactID;
|
||||
private int _artefactID;
|
||||
private string _artefactDialogue;
|
||||
[SerializeField] private SerialInt _nearbyArtefactID;
|
||||
|
||||
[SerializeField] private ArtefactSystem _artefacts;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
_artefactID = data.artefactID;
|
||||
_artefactDialogue = data.artefactDialogue;
|
||||
_show = data.show;
|
||||
_canInteract = data.canInteract;
|
||||
|
||||
|
@ -55,14 +56,10 @@ public class ArtefactControl : MonoBehaviour
|
|||
{
|
||||
if (_canInteract == true)
|
||||
{
|
||||
ArtefactInventory.addA(data);
|
||||
foreach (var x in ArtefactInventory.artefactList)
|
||||
{
|
||||
Debug.Log(x.ToString());
|
||||
}
|
||||
|
||||
// artefact system informs other systems about found artefact
|
||||
_artefacts.FindArtefact(data);
|
||||
}
|
||||
//here put 'show artifact dialogue'
|
||||
|
||||
if (this.gameObject != null)
|
||||
Destroy(this.gameObject);
|
||||
_nearbyArtefactID.Value = -1;
|
||||
|
|
|
@ -3,27 +3,23 @@ using System.Collections;
|
|||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
[CreateAssetMenu(menuName = "KernelPanic/Artefacts/Inventory")]
|
||||
public class ArtefactInventory : ScriptableObject
|
||||
{
|
||||
public static List<Artefact> artefactList = new List<Artefact>();
|
||||
private static bool exists = false;
|
||||
private readonly List<Artefact> artefactList = new List<Artefact>();
|
||||
|
||||
public static void addA(Artefact a)
|
||||
public void addA(Artefact a)
|
||||
{
|
||||
//check if duplicate in the list
|
||||
exists = false;
|
||||
foreach (Artefact x in artefactList)
|
||||
{
|
||||
if (x.artefactID == a.artefactID)
|
||||
exists = true;
|
||||
{
|
||||
Debug.LogError($"{a} already exists in inventory", this);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if ( exists == false)
|
||||
{
|
||||
artefactList.Add(a);
|
||||
}
|
||||
|
||||
artefactList.Add(a);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
[CreateAssetMenu(menuName = "KernelPanic/Artefacts/Artefact System")]
|
||||
public class ArtefactSystem : ScriptableObject
|
||||
{
|
||||
[SerializeField] private DialogueSystem _dialogue;
|
||||
[SerializeField] private ArtefactInventory _inventory;
|
||||
|
||||
public void FindArtefact(Artefact artefact)
|
||||
{
|
||||
_inventory.addA(artefact);
|
||||
|
||||
_dialogue.PlayLine(artefact.dialogueKey);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: d089d711384390948a578301b55b65f9
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -68,6 +68,12 @@ public static partial class DialogueDatabase
|
|||
var lines = 0;
|
||||
foreach (var row in values)
|
||||
{
|
||||
if (row.Count != 2)
|
||||
{
|
||||
Debug.Log($":: skipping non-matching line: {lines}: {(row.Count == 0 ? "empty" : string.Join(",", row))}");
|
||||
continue;
|
||||
}
|
||||
|
||||
sb.AppendLine($"{row[0]}{SPLIT_CHAR}{row[1]}");
|
||||
lines++;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using FMOD.Studio;
|
||||
using UnityEngine;
|
||||
#if UNITY_EDITOR
|
||||
using UnityEditor;
|
||||
|
@ -29,7 +30,17 @@ public partial class DialogueSystem : ScriptableObject
|
|||
{
|
||||
// retrieve cached key
|
||||
var fmodKey = _fmodKeyCache[key];
|
||||
var eventDescription = FMODUnity.RuntimeManager.GetEventDescription(fmodKey);
|
||||
|
||||
EventDescription? eventDescription = null;
|
||||
|
||||
try
|
||||
{
|
||||
eventDescription = FMODUnity.RuntimeManager.GetEventDescription(fmodKey);
|
||||
}
|
||||
catch (FMODUnity.EventNotFoundException e)
|
||||
{
|
||||
Debug.LogWarning($"no FMOD event {fmodKey}");
|
||||
}
|
||||
|
||||
DialogueLine dl;
|
||||
dl.text = DialogueDatabase.ReadDialogue(key);
|
||||
|
@ -37,12 +48,12 @@ public partial class DialogueSystem : ScriptableObject
|
|||
dl.duration = _settings.HideAfter;
|
||||
|
||||
// read audio data out of FMOD, check if event exists
|
||||
if (eventDescription.isValid())
|
||||
if (eventDescription.HasValue)
|
||||
{
|
||||
// assign values and play audio
|
||||
|
||||
// get dialogue line duration from FMOD
|
||||
eventDescription.getLength(out int ms);
|
||||
eventDescription.Value.getLength(out int ms);
|
||||
|
||||
// get length gives us a value in milliseconds so it needs to be converted to seconds
|
||||
// before assignment
|
||||
|
@ -51,11 +62,6 @@ public partial class DialogueSystem : ScriptableObject
|
|||
// event is valid
|
||||
FMODUnity.RuntimeManager.PlayOneShot(fmodKey);
|
||||
}
|
||||
else
|
||||
{
|
||||
// no event available boooooooo
|
||||
Debug.LogError($"FMOD event desc for key {fmodKey} is not valid", this);
|
||||
}
|
||||
|
||||
onDialogueLine?.Invoke(this, dl);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue