57 lines
1.3 KiB
C#
57 lines
1.3 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
namespace Beyond
|
|
{
|
|
public class CompassMarker : MonoBehaviour
|
|
{
|
|
public Sprite m_sprite;
|
|
private float m_minDistance = 0f;
|
|
|
|
public float MinDistance
|
|
{
|
|
get => m_minDistance;
|
|
set
|
|
{
|
|
m_minDistance = value;
|
|
if (enabled)
|
|
{
|
|
Compass.Instance.SetQuestMarkerDistance(transform, value);
|
|
}
|
|
}
|
|
}
|
|
|
|
IEnumerator RemoveCoroutine(float time)
|
|
{
|
|
yield return new WaitForSeconds(time);
|
|
Destroy(this);
|
|
yield return null;
|
|
}
|
|
|
|
public void RemoveAfterTime(float time)
|
|
{
|
|
StartCoroutine(RemoveCoroutine(time));
|
|
}
|
|
private void OnEnable()
|
|
{
|
|
if (Compass.Instance)
|
|
Compass.Instance.AddQuestMarker(transform,m_sprite, m_minDistance);
|
|
}
|
|
/*
|
|
private void OnDisable()
|
|
{
|
|
Compass.Instance.RemoveQuestMarker(transform);
|
|
}
|
|
*/
|
|
|
|
private void OnDisable()
|
|
{
|
|
if (Compass.Instance)
|
|
Compass.Instance.RemoveQuestMarker(transform);
|
|
}
|
|
|
|
}
|
|
}
|