57 lines
1.5 KiB
C#
57 lines
1.5 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.Events;
|
|
|
|
namespace Beyond
|
|
{
|
|
public class HiddenObject : Scannable
|
|
{
|
|
[Tooltip("Collider that should be active with silent peek")]
|
|
public Collider m_actionCollider;
|
|
|
|
private bool alreadyUsed = false;
|
|
|
|
// Start is called before the first frame update
|
|
private void Start()
|
|
{
|
|
if (SilentPeekController.instance != null)
|
|
SilentPeekController.instance.m_OnStateChanged.AddListener(OnSilentPeek);
|
|
if (m_actionCollider)
|
|
m_actionCollider.enabled = false;
|
|
}
|
|
|
|
private void OnDestroy()
|
|
{
|
|
if (SilentPeekController.instance != null)
|
|
SilentPeekController.instance.m_OnStateChanged.RemoveListener(OnSilentPeek);
|
|
Compass.Instance.RemoveQuestMarker(transform);
|
|
}
|
|
|
|
private void OnSilentPeek(bool enabled)
|
|
{
|
|
if (alreadyUsed && enabled)
|
|
{
|
|
return;
|
|
}
|
|
if (m_actionCollider)
|
|
m_actionCollider.enabled = enabled;
|
|
}
|
|
|
|
public void MarkAsAlreadyUsed()
|
|
{
|
|
alreadyUsed = true;
|
|
}
|
|
|
|
// Update is called once per frame
|
|
private void Update()
|
|
{
|
|
}
|
|
|
|
public override void OnScanned()
|
|
{
|
|
base.OnScanned();
|
|
//Compass.Instance.AddQuestMarker(transform, null, m_minCompassDistance);
|
|
}
|
|
}
|
|
} |