using UnityEngine; using System.Collections; using AX.MessageSystem; using UnityEngine.UI; public class CarAndPeopleControl : MonoBehaviour { void Awake () { MessageDispatcher.AddListener("CarAndPeopleColorCondition", CarAndPeopleButton); } void CarAndPeopleButton(IMessage message) { var PictureObj = transform.parent.parent.Find(gameObject.name + "Picture").gameObject; if ((string)message.Data == this.gameObject.name) { MessageDispatcher.SendMessage("ResettingButton", (object)this.name); //InstantiationTool.Instance.RSDToggle.isOn = false; this.gameObject.transform.Find("Image").gameObject.SetActive(true); this.gameObject.transform.Find("Text").GetComponent().color = new Color(1f, 1f, 1f, 1.000f); PictureObj.SetActive(true); } else { PictureObj.SetActive(false); this.gameObject.transform.Find("Image").gameObject.SetActive(false); this.gameObject.transform.Find("Text").GetComponent().color = new Color(0.529f, 0.529f, 0.529f, 1.000f); } } void Update () { } void OnDestroy() { MessageDispatcher.RemoveListener("CarAndPeopleColorCondition", CarAndPeopleButton); } }