You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
45 lines
1.1 KiB
45 lines
1.1 KiB
3 years ago
|
using UnityEngine;
|
||
|
using System.Collections;
|
||
|
using UnityEngine.UI;
|
||
|
using AX.MessageSystem;
|
||
|
public class NodeTreeHints : MonoBehaviour {
|
||
|
|
||
|
// Use this for initialization
|
||
|
void Start()
|
||
|
{
|
||
|
MessageDispatcher.AddListener("NodeTreeHints", nodeTreeHints);
|
||
|
MessageDispatcher.AddListener("CloseNodeTreeHints", closenodeTreeHints);
|
||
|
this.gameObject.SetActive(false);
|
||
|
}
|
||
|
|
||
|
// Update is called once per frame
|
||
|
float T = 3f;
|
||
|
void Update ()
|
||
|
{
|
||
|
if (T > 0)
|
||
|
{
|
||
|
T -= Time.deltaTime;
|
||
|
if (T < 0)
|
||
|
{
|
||
|
this.gameObject.SetActive(false);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|
||
|
void nodeTreeHints(IMessage message)
|
||
|
{
|
||
|
T = (float)message.Sender;
|
||
|
this.gameObject.SetActive(true);
|
||
|
this.transform.Find("Text").GetComponent<Text>().text = message.Data.ToString();
|
||
|
}
|
||
|
void closenodeTreeHints(IMessage message)
|
||
|
{
|
||
|
this.gameObject.SetActive(false);
|
||
|
}
|
||
|
void OnDestroy()
|
||
|
{
|
||
|
MessageDispatcher.RemoveListener("NodeTreeHints", nodeTreeHints);
|
||
|
MessageDispatcher.RemoveListener("CloseNodeTreeHints", closenodeTreeHints);
|
||
|
}
|
||
|
}
|