Merge branch 'bug/artefact-interaction' into 'main'

Bug/artefact interaction

Closes #65

See merge request kernel-panic/revival!30
This commit is contained in:
Cinder Foster-Smith 2021-03-05 15:34:08 +00:00
commit f31bea874a
30 changed files with 297 additions and 144 deletions

View File

@ -17,6 +17,7 @@ open -g $editorpath --args \
-batchmode \ -batchmode \
-quit \ -quit \
-nographics \ -nographics \
-developmentBuild \
-executeMethod "Ktyl.Util.BuildCommand.Run" \ -executeMethod "Ktyl.Util.BuildCommand.Run" \
-logFile $editorlogpath \ -logFile $editorlogpath \
-projectPath "$(pwd)/game" -projectPath "$(pwd)/game"

View File

@ -14,3 +14,4 @@ MonoBehaviour:
m_EditorClassIdentifier: m_EditorClassIdentifier:
_dialogue: {fileID: 11400000, guid: 56369c4e83cc59e44bf55cd16fafc4e8, type: 2} _dialogue: {fileID: 11400000, guid: 56369c4e83cc59e44bf55cd16fafc4e8, type: 2}
_inventory: {fileID: 11400000, guid: 1a9441435aa1fc649a84169f689c7f53, type: 2} _inventory: {fileID: 11400000, guid: 1a9441435aa1fc649a84169f689c7f53, type: 2}
_nearbyArtefactId: {fileID: 11400000, guid: caba70196fbb1c549a934f7566f7a247, type: 2}

View File

@ -10,7 +10,7 @@ MonoBehaviour:
m_Enabled: 1 m_Enabled: 1
m_EditorHideFlags: 0 m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: cc38ab5b9e594a344a8eb1635487d5eb, type: 3} m_Script: {fileID: 11500000, guid: cc38ab5b9e594a344a8eb1635487d5eb, type: 3}
m_Name: nearbyArtefactID m_Name: Nearby Artefact ID
m_EditorClassIdentifier: m_EditorClassIdentifier:
_initialValue: -1 _initialValue: -1
_readOnly: 0 _readOnly: 0

View File

@ -1,74 +1,109 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 684d4d47a018ed14080e15f4c99b8e86 guid: 684d4d47a018ed14080e15f4c99b8e86
PluginImporter: PluginImporter:
serializedVersion: 1 externalObjects: {}
serializedVersion: 2
iconMap: {} iconMap: {}
executionOrder: {} executionOrder: {}
defineConstraints: []
isPreloaded: 0 isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData: platformData:
Android: - first:
enabled: 0 : Linux
settings: second:
CPU: AnyCPU
Any:
enabled: 0
settings: {}
Editor:
enabled: 1
settings:
CPU: x86_64
DefaultValueInitialized: true
OS: Windows
Linux:
enabled: 1 enabled: 1
settings: settings:
CPU: None CPU: None
Linux64: - first:
enabled: 1 : LinuxUniversal
settings: second:
CPU: x86_64
LinuxUniversal:
enabled: 1 enabled: 1
settings: settings:
CPU: AnyCPU CPU: AnyCPU
OSXIntel: - first:
: OSXIntel
second:
enabled: 1 enabled: 1
settings: settings:
CPU: None CPU: None
OSXIntel64: - first:
: OSXIntel64
second:
enabled: 1 enabled: 1
settings: settings:
CPU: AnyCPU CPU: AnyCPU
OSXUniversal: - first:
enabled: 1 : SamsungTV
settings: second:
CPU: AnyCPU
SamsungTV:
enabled: 0 enabled: 0
settings: settings:
STV_MODEL: STANDARD_13 STV_MODEL: STANDARD_13
WP8: - first:
: WP8
second:
enabled: 0 enabled: 0
settings: settings:
CPU: AnyCPU CPU: AnyCPU
DontProcess: False DontProcess: False
PlaceholderPath: PlaceholderPath:
Win: - first:
Android: Android
second:
enabled: 0 enabled: 0
settings: settings:
CPU: None CPU: AnyCPU
Win64: - first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 1
settings:
CPU: x86_64
DefaultValueInitialized: true
OS: Windows
- first:
Standalone: Linux64
second:
enabled: 1 enabled: 1
settings: settings:
CPU: AnyCPU CPU: AnyCPU
WindowsStoreApps: - first:
Standalone: OSXUniversal
second:
enabled: 1
settings:
CPU: AnyCPU
- first:
Standalone: Win
second:
enabled: 0
settings:
CPU: None
- first:
Standalone: Win64
second:
enabled: 0
settings:
CPU: AnyCPU
- first:
Windows Store Apps: WindowsStoreApps
second:
enabled: 0 enabled: 0
settings: settings:
CPU: AnyCPU CPU: AnyCPU
DontProcess: False DontProcess: False
PlaceholderPath: PlaceholderPath:
SDK: AnySDK SDK: AnySDK
iOS: - first:
iPhone: iOS
second:
enabled: 0 enabled: 0
settings: settings:
CompileFlags: CompileFlags:

View File

@ -2476,15 +2476,15 @@ PrefabInstance:
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 4676633831318799747, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3} - target: {fileID: 4676633831318799747, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
propertyPath: m_LocalRotation.x propertyPath: m_LocalRotation.x
value: 0.14211853 value: 0.14211854
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 4676633831318799747, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3} - target: {fileID: 4676633831318799747, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
propertyPath: m_LocalRotation.y propertyPath: m_LocalRotation.y
value: -2.2566488e-22 value: 1.1133053e-25
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 4676633831318799747, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3} - target: {fileID: 4676633831318799747, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
propertyPath: m_LocalRotation.z propertyPath: m_LocalRotation.z
value: 2.3205715e-23 value: -4.9127595e-24
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 4676633831388223341, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3} - target: {fileID: 4676633831388223341, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
propertyPath: m_LocalPosition.x propertyPath: m_LocalPosition.x
@ -2504,15 +2504,15 @@ PrefabInstance:
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 4676633831388223341, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3} - target: {fileID: 4676633831388223341, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
propertyPath: m_LocalRotation.x propertyPath: m_LocalRotation.x
value: 0.1419703 value: 0.14197029
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 4676633831388223341, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3} - target: {fileID: 4676633831388223341, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
propertyPath: m_LocalRotation.y propertyPath: m_LocalRotation.y
value: 0.04519987 value: 0.045199864
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 4676633831388223341, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3} - target: {fileID: 4676633831388223341, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
propertyPath: m_LocalRotation.z propertyPath: m_LocalRotation.z
value: -0.0064896117 value: -0.0064896103
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 4676633831414007564, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3} - target: {fileID: 4676633831414007564, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
propertyPath: m_Name propertyPath: m_Name
@ -2600,15 +2600,15 @@ PrefabInstance:
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 4676633832789495666, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3} - target: {fileID: 4676633832789495666, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
propertyPath: m_LocalRotation.x propertyPath: m_LocalRotation.x
value: 0.14211851 value: 0.14211854
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 4676633832789495666, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3} - target: {fileID: 4676633832789495666, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
propertyPath: m_LocalRotation.y propertyPath: m_LocalRotation.y
value: -7.529077e-16 value: -0.0000000034819871
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 4676633832789495666, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3} - target: {fileID: 4676633832789495666, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
propertyPath: m_LocalRotation.z propertyPath: m_LocalRotation.z
value: 4.582889e-18 value: 4.999292e-10
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 4676633832858914730, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3} - target: {fileID: 4676633832858914730, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
propertyPath: m_XAxis.m_InvertInput propertyPath: m_XAxis.m_InvertInput
@ -2636,11 +2636,11 @@ PrefabInstance:
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 4676633832928372887, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3} - target: {fileID: 4676633832928372887, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
propertyPath: m_LocalRotation.y propertyPath: m_LocalRotation.y
value: 0.04519986 value: 0.045199856
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 4676633832928372887, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3} - target: {fileID: 4676633832928372887, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
propertyPath: m_LocalRotation.z propertyPath: m_LocalRotation.z
value: -0.006489608 value: -0.006489607
objectReference: {fileID: 0} objectReference: {fileID: 0}
m_RemovedComponents: [] m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3} m_SourcePrefab: {fileID: 100100000, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
@ -7128,12 +7128,11 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
artefactUI: {fileID: 483749937} artefactUI: {fileID: 483749937}
nearbyArtefactID: {fileID: 11400000, guid: caba70196fbb1c549a934f7566f7a247, type: 2}
Player: {fileID: 1239556274} Player: {fileID: 1239556274}
artefactText: {fileID: 59318657} artefactText: {fileID: 59318657}
Artefacts: {fileID: 1112305613}
inputSettings: {fileID: 11400000, guid: 87faf39b6f22e524984c1680a88045ac, type: 2} inputSettings: {fileID: 11400000, guid: 87faf39b6f22e524984c1680a88045ac, type: 2}
dialogue: {fileID: 11400000, guid: 56369c4e83cc59e44bf55cd16fafc4e8, type: 2} dialogue: {fileID: 11400000, guid: 56369c4e83cc59e44bf55cd16fafc4e8, type: 2}
artefacts: {fileID: 11400000, guid: f523ac0d77530064b8b41c627b13fae0, type: 2}
--- !u!114 &2070784759 --- !u!114 &2070784759
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@ -1,3 +1,4 @@
using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
@ -6,8 +7,6 @@ using UnityEngine.Events;
public class ArtefactControl : MonoBehaviour public class ArtefactControl : MonoBehaviour
{ {
private bool _show; private bool _show;
protected bool _canInteract; protected bool _canInteract;
@ -21,6 +20,11 @@ public class ArtefactControl : MonoBehaviour
[SerializeField] private ArtefactSystem _artefacts; [SerializeField] private ArtefactSystem _artefacts;
private void OnEnable()
{
_artefacts.RegisterArtefact(_data);
}
protected virtual void Start() protected virtual void Start()
{ {
_artefactID = data.artefactID; _artefactID = data.artefactID;

View File

@ -1,5 +1,8 @@
using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Runtime.InteropServices;
using Ktyl.Util;
using UnityEngine; using UnityEngine;
[CreateAssetMenu(menuName = "KernelPanic/Artefacts/Artefact System")] [CreateAssetMenu(menuName = "KernelPanic/Artefacts/Artefact System")]
@ -7,6 +10,36 @@ public class ArtefactSystem : ScriptableObject
{ {
[SerializeField] private DialogueSystem _dialogue; [SerializeField] private DialogueSystem _dialogue;
[SerializeField] private ArtefactInventory _inventory; [SerializeField] private ArtefactInventory _inventory;
[SerializeField] private SerialInt _nearbyArtefactId;
private readonly List<Artefact> _artefacts = new List<Artefact>();
public Artefact GetNearbyArtefact()
{
return _nearbyArtefactId == -1 ? null : GetArtefact(_nearbyArtefactId);
}
private Artefact GetArtefact(int id)
{
for (int i = 0; i < _artefacts.Count; i++)
{
if (_artefacts[i].artefactID == id) return _artefacts[i];
}
Debug.LogError($"no registered artefact with id {id}");
return null;
}
public void RegisterArtefact(Artefact artefact)
{
if (_artefacts.Contains(artefact))
{
Debug.LogError($"{artefact} already registered", this);
return;
}
_artefacts.Add(artefact);
}
public void FindArtefact(Artefact artefact) public void FindArtefact(Artefact artefact)
{ {
@ -14,4 +47,9 @@ public class ArtefactSystem : ScriptableObject
// _dialogue.PlayLine(artefact.dialogueKey); // _dialogue.PlayLine(artefact.dialogueKey);
} }
private void OnDisable()
{
_artefacts.Clear();
}
} }

View File

@ -6,7 +6,6 @@ using UnityEngine;
public class EventHandler : MonoBehaviour public class EventHandler : MonoBehaviour
{ {
//[SerializeField] private SerialInt nearbyArtefactID;
public static EventHandler current; public static EventHandler current;
private void Awake() private void Awake()
@ -39,10 +38,7 @@ public class EventHandler : MonoBehaviour
{ {
if (onArtefactPickUp != null) if (onArtefactPickUp != null)
{ {
//if(nearbyArtefactID != -1)
// {
onArtefactPickUp(id); onArtefactPickUp(id);
//}
} }
} }

View File

@ -11,40 +11,29 @@ public class PickUpDisplay : MonoBehaviour
[SerializeField] private static bool _paused; [SerializeField] private static bool _paused;
[SerializeField] private GameObject artefactUI; [SerializeField] private GameObject artefactUI;
[SerializeField] private SerialInt nearbyArtefactID;
[SerializeField] private GameObject Player; [SerializeField] private GameObject Player;
[SerializeField] private Text artefactText; [SerializeField] private Text artefactText;
[SerializeField] private GameObject Artefacts;
[SerializeField] private InputSettings inputSettings; [SerializeField] private InputSettings inputSettings;
[SerializeField] private DialogueSystem dialogue; [SerializeField] private DialogueSystem dialogue;
[SerializeField] private ArtefactSystem artefacts;
private Artefact chosenArtefact; private Artefact chosenArtefact;
private static List<Artefact> completeList = new List<Artefact>();
private void Awake() private void Start()
{ {
EventHandler.current.onArtefactUI += PopUpOn; EventHandler.current.onArtefactUI += PopUpOn;
int i;
for(i=0; i<Artefacts.transform.childCount; i++)
{
completeList.Add(Artefacts.transform.GetChild(i).GetComponent<ArtefactControl>().data);
}
} }
private void FixedUpdate() private void Update()
{ {
foreach(Artefact arte in completeList) var artefact = artefacts.GetNearbyArtefact();
{ if (!artefact) return;
if (nearbyArtefactID != -1 && arte.artefactID == nearbyArtefactID)
chosenArtefact = arte; chosenArtefact = artefact;
}
} }
public void PopUpOn() public void PopUpOn()
{ {
;
_paused = true; _paused = true;
artefactUI.SetActive(true); artefactUI.SetActive(true);
Player.GetComponent<PlayerInput>().enabled = false; Player.GetComponent<PlayerInput>().enabled = false;

View File

@ -1,26 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class RespawnManager : MonoBehaviour
{
private Vector3 respawnPoint;
// Set respawn point in Respawn Manager.
public void SetRespawnPoint(Vector3 _respawnPoint)
{
respawnPoint = _respawnPoint;
}
// Return the respawn point.
public Vector3 GetRespawnPoint()
{
return respawnPoint;
}
// Show current respawn point in log. This can be deleted at later stage.
private void Update()
{
Debug.Log("Respawn point is: " + respawnPoint);
}
}

View File

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

BIN
game/Assets/StreamingAssets/Dialogue_CN.bank (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 90356c5beb272664687199ea3e14fa86
labels:
- FMOD
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

BIN
game/Assets/StreamingAssets/Dialogue_EN.bank (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: f6b5fef480e45f3458dbe489b0583f75
labels:
- FMOD
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

BIN
game/Assets/StreamingAssets/Dialogue_JP.bank (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: a9b7aec0dbd482f489b727b6c3ab3fd3
labels:
- FMOD
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

BIN
game/Assets/StreamingAssets/Master.bank (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 7f91c2a4d80b21a43abbde2b94674471
labels:
- FMOD
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

BIN
game/Assets/StreamingAssets/Master.strings.bank (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 6cdac34c226618e4aa6807660280989b
labels:
- FMOD
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

BIN
game/Assets/StreamingAssets/Music.bank (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 72ba6873e27408642a2a1dcb70d89708
labels:
- FMOD
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

BIN
game/Assets/StreamingAssets/SFX.bank (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 4d435d34707c1814d8c4468be808e847
labels:
- FMOD
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

BIN
game/Assets/StreamingAssets/VO.bank (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 701b4f629f263dd49a2c6eb4bace07bc
labels:
- FMOD
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

BIN
game/Assets/StreamingAssets/Vehicles.bank (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 173ac73c679d2224aa381238b45d2cf5
labels:
- FMOD
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant: