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.
41 lines
913 B
41 lines
913 B
3 years ago
|
using UnityEngine;
|
||
|
using System.Collections;
|
||
|
using AX.MessageSystem;
|
||
|
|
||
|
public class test : MonoBehaviour {
|
||
|
|
||
|
// Use this for initialization
|
||
|
|
||
|
void Start () {
|
||
|
MessageDispatcher.AddListener("OPEN", Execute, "CUBE");
|
||
|
MessageDispatcher.AddListener("CLOSE", Close, "CUBE");
|
||
|
this.gameObject.SetActive(false);
|
||
|
}
|
||
|
void OnDestroy()
|
||
|
{
|
||
|
MessageDispatcher.RemoveListener("OPEN", Execute, "CUBE");
|
||
|
MessageDispatcher.RemoveListener("CLOSE", Close, "CUBE");
|
||
|
}
|
||
|
// Update is called once per frame
|
||
|
void Update () {
|
||
|
|
||
|
}
|
||
|
|
||
|
void Execute(IMessage message)
|
||
|
{
|
||
|
if ((string)message.Data == this.gameObject.name)
|
||
|
{
|
||
|
this.gameObject.SetActive(true);
|
||
|
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void Close(IMessage message)
|
||
|
{
|
||
|
if ((string)message.Data == this.gameObject.name)
|
||
|
{
|
||
|
this.gameObject.SetActive(false);
|
||
|
}
|
||
|
}
|
||
|
}
|