Added nearbyArtefactID SerialInt
This commit is contained in:
parent
4397ec0326
commit
f5cc5a4f14
|
@ -225,10 +225,18 @@ PrefabInstance:
|
|||
propertyPath: data
|
||||
value:
|
||||
objectReference: {fileID: 11400000, guid: 38f76e60d5df1d445a455c63a88da8e1, type: 2}
|
||||
- target: {fileID: 8781564214016862072, guid: 2dae894ec500e524a88f985657f9682d, type: 3}
|
||||
propertyPath: _nearbyArtefactID
|
||||
value:
|
||||
objectReference: {fileID: 11400000, guid: caba70196fbb1c549a934f7566f7a247, type: 2}
|
||||
- target: {fileID: 8781564214893312972, guid: 2dae894ec500e524a88f985657f9682d, type: 3}
|
||||
propertyPath: _id
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8781564214893312972, guid: 2dae894ec500e524a88f985657f9682d, type: 3}
|
||||
propertyPath: _nearbyArtefactID
|
||||
value:
|
||||
objectReference: {fileID: 11400000, guid: caba70196fbb1c549a934f7566f7a247, type: 2}
|
||||
m_RemovedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: 2dae894ec500e524a88f985657f9682d, type: 3}
|
||||
--- !u!1 &349701919
|
||||
|
@ -830,6 +838,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!54 &1292675914
|
||||
Rigidbody:
|
||||
|
@ -906,10 +915,18 @@ PrefabInstance:
|
|||
propertyPath: data
|
||||
value:
|
||||
objectReference: {fileID: 11400000, guid: 4c18fa3513891124282e56285b09c211, type: 2}
|
||||
- target: {fileID: 8781564214016862072, guid: 2dae894ec500e524a88f985657f9682d, type: 3}
|
||||
propertyPath: _nearbyArtefactID
|
||||
value:
|
||||
objectReference: {fileID: 11400000, guid: caba70196fbb1c549a934f7566f7a247, type: 2}
|
||||
- target: {fileID: 8781564214893312972, guid: 2dae894ec500e524a88f985657f9682d, type: 3}
|
||||
propertyPath: _id
|
||||
value: 2
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8781564214893312972, guid: 2dae894ec500e524a88f985657f9682d, type: 3}
|
||||
propertyPath: _nearbyArtefactID
|
||||
value:
|
||||
objectReference: {fileID: 11400000, guid: caba70196fbb1c549a934f7566f7a247, type: 2}
|
||||
m_RemovedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: 2dae894ec500e524a88f985657f9682d, type: 3}
|
||||
--- !u!1 &1444606336
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using Ktyl.Util;
|
||||
|
||||
public class ArtefactControl : MonoBehaviour
|
||||
{
|
||||
|
@ -14,6 +15,7 @@ public class ArtefactControl : MonoBehaviour
|
|||
public int artefactID => _artefactID;
|
||||
private int _artefactID;
|
||||
private string _artefactDialogue;
|
||||
[SerializeField] private SerialInt _nearbyArtefactID;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
|
@ -63,7 +65,8 @@ public class ArtefactControl : MonoBehaviour
|
|||
//here put 'show artifact dialogue'
|
||||
if (this.gameObject != null)
|
||||
Destroy(this.gameObject);
|
||||
PlayerInputHandler.id = 0;
|
||||
_nearbyArtefactID.Value = 0;
|
||||
//PlayerInputHandler.id = 0;
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,22 +1,27 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using Ktyl.Util;
|
||||
|
||||
public class ArtefactTriggerArea : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private SerialInt _nearbyArtefactID;
|
||||
|
||||
public int id => _id;
|
||||
[SerializeField] private int _id;
|
||||
|
||||
private void OnTriggerEnter(Collider Player)
|
||||
{
|
||||
EventHandler.current.ArtefactTriggerEnter(_id);
|
||||
PlayerInputHandler.id = _id;
|
||||
//PlayerInputHandler.id = _id;
|
||||
_nearbyArtefactID.Value = _id;
|
||||
}
|
||||
|
||||
private void OnTriggerExit(Collider Player)
|
||||
{
|
||||
EventHandler.current.ArtefactTriggerExit(_id);
|
||||
PlayerInputHandler.id = 0;
|
||||
//PlayerInputHandler.id = 0;
|
||||
_nearbyArtefactID.Value = -1;
|
||||
}
|
||||
|
||||
}
|
|
@ -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
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: caba70196fbb1c549a934f7566f7a247
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -3,16 +3,12 @@ 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
|
||||
private static int _id;
|
||||
public static int id
|
||||
{
|
||||
get { return _id; }
|
||||
set { _id = value; }
|
||||
}
|
||||
[SerializeField] private SerialInt _nearbyArtefactID;
|
||||
|
||||
[SerializeField]
|
||||
private PlayerInputSettings _inputSettings;
|
||||
|
@ -63,6 +59,6 @@ public class PlayerInputHandler : MonoBehaviour
|
|||
public void Use(InputAction.CallbackContext context)
|
||||
{
|
||||
if(context.started)
|
||||
EventHandler.current.ArtefactPickUp(_id);
|
||||
EventHandler.current.ArtefactPickUp(_nearbyArtefactID.Value);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue