artefactUI now works
This commit is contained in:
parent
81ef58415a
commit
af34631ed8
File diff suppressed because it is too large
Load Diff
|
@ -11,6 +11,9 @@ public class Artefact : ScriptableObject
|
|||
public string artefactDialogue => _artefactDialogue;
|
||||
[SerializeField] private string _artefactDialogue;
|
||||
|
||||
public string Name => _name;
|
||||
[SerializeField] private string _name;
|
||||
|
||||
public bool show => _show;
|
||||
private bool _show = false;
|
||||
public bool canInteract => _canInteract;
|
||||
|
|
|
@ -10,19 +10,19 @@ public class ArtefactControl : MonoBehaviour
|
|||
private bool _show;
|
||||
protected bool _canInteract;
|
||||
|
||||
[SerializeField]
|
||||
private Artefact data;
|
||||
public Artefact data => _data;
|
||||
[SerializeField] private Artefact _data;
|
||||
public int artefactID => _artefactID;
|
||||
private int _artefactID;
|
||||
private string _artefactDialogue;
|
||||
[SerializeField] private SerialInt _nearbyArtefactID;
|
||||
|
||||
protected virtual void Start()
|
||||
protected virtual void Awake()
|
||||
{
|
||||
_artefactID = data.artefactID;
|
||||
_artefactDialogue = data.artefactDialogue;
|
||||
_show = data.show;
|
||||
_canInteract = data.canInteract;
|
||||
_artefactID = _data.artefactID;
|
||||
_artefactDialogue = _data.artefactDialogue;
|
||||
_show = _data.show;
|
||||
_canInteract = _data.canInteract;
|
||||
|
||||
EventHandler.current.onArtefactTriggerEnter += NearArtefact;
|
||||
EventHandler.current.onArtefactTriggerExit += AwayArtefact;
|
||||
|
@ -56,17 +56,18 @@ public class ArtefactControl : MonoBehaviour
|
|||
{
|
||||
if (_canInteract == true)
|
||||
{
|
||||
ArtefactInventory.addA(data);
|
||||
foreach (var x in ArtefactInventory.artefactList)
|
||||
{
|
||||
Debug.Log(x.ToString());
|
||||
}
|
||||
ArtefactInventory.addA(_data);
|
||||
//debug ArtefactInventory
|
||||
//foreach (var x in ArtefactInventory.artefactList)
|
||||
//{
|
||||
// Debug.Log(x.ToString());
|
||||
//}
|
||||
|
||||
}
|
||||
//here put 'show artifact dialogue'
|
||||
if (this.gameObject != null)
|
||||
{
|
||||
data.PowerUnlock();
|
||||
_data.PowerUnlock();
|
||||
_nearbyArtefactID.Value = -1;
|
||||
_canInteract = false;
|
||||
EventHandler.current.ArtefactUI();
|
||||
|
|
|
@ -7,6 +7,7 @@ public class ArtefactInventory : ScriptableObject
|
|||
{
|
||||
public static List<Artefact> artefactList = new List<Artefact>();
|
||||
private static bool exists = false;
|
||||
|
||||
|
||||
public static void addA(Artefact a)
|
||||
{
|
||||
|
|
|
@ -10,8 +10,9 @@ MonoBehaviour:
|
|||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 0228856d50ce2a845abd7b3eda114390, type: 3}
|
||||
m_Name: Power1
|
||||
m_Name: PowerBlink
|
||||
m_EditorClassIdentifier:
|
||||
_power: {fileID: 11400000, guid: b47ea197a7cc2ed4eb15271cef672997, type: 2}
|
||||
_artefactID: 1
|
||||
_artefactDialogue:
|
||||
_name: Blink
|
|
@ -10,8 +10,9 @@ MonoBehaviour:
|
|||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 0228856d50ce2a845abd7b3eda114390, type: 3}
|
||||
m_Name: Power2
|
||||
m_Name: PowerBoost
|
||||
m_EditorClassIdentifier:
|
||||
_power: {fileID: 11400000, guid: d5ed942937d8cca478f3ec97f6b9c8a2, type: 2}
|
||||
_artefactID: 2
|
||||
_artefactDialogue:
|
||||
_name: Boost
|
|
@ -2,6 +2,8 @@ using Ktyl.Util;
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class PickUpDisplay : MonoBehaviour
|
||||
{
|
||||
|
@ -10,22 +12,48 @@ public class PickUpDisplay : MonoBehaviour
|
|||
|
||||
[SerializeField] private GameObject artefactUI;
|
||||
[SerializeField] private SerialInt nearbyArtefactID;
|
||||
[SerializeField] private GameObject Player;
|
||||
[SerializeField] private Text artefactText;
|
||||
[SerializeField] private GameObject Artefacts;
|
||||
|
||||
private void Start()
|
||||
private Artefact chosenArtefact;
|
||||
private static List<Artefact> completeList = new List<Artefact>();
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
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()
|
||||
{
|
||||
foreach(Artefact arte in completeList)
|
||||
{
|
||||
if (nearbyArtefactID != -1 && arte.artefactID == nearbyArtefactID)
|
||||
chosenArtefact = arte;
|
||||
}
|
||||
}
|
||||
|
||||
public void PopUpOn()
|
||||
{
|
||||
_paused = true;
|
||||
artefactUI.SetActive(true);
|
||||
Time.timeScale = 0.0f;
|
||||
Player.GetComponent<PlayerInput>().enabled = false;
|
||||
artefactText.text = "You have unlocked " + chosenArtefact.Name + "!";
|
||||
//Time.timeScale = 0f;
|
||||
}
|
||||
|
||||
public void PopUpOff()
|
||||
{
|
||||
_paused = false;
|
||||
artefactUI.SetActive(false);
|
||||
Time.timeScale = 1.0f;
|
||||
Player.GetComponent<PlayerInput>().enabled = true;
|
||||
//Time.timeScale = 1.0f;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue