using AX.MessageSystem; using System; using System.Collections; using System.Collections.Generic; using UnityEngine; public class WaterCurtainControl : CloneGameObjInfo { public override void Awake() { base.Awake(); gameObjType = CloneObjType.CurtainLine; gameObject.SetActive(false); MessageDispatcher.AddListener("ControlWaterCurtain", ControlCurtain); } private void ControlCurtain(IMessage obj) { var data = (CurtainData)obj.Data; if (data.id == this.gameObjID) { gameObject.SetActive(data.on); } } public override void OnDestroy() { base.OnDestroy(); MessageDispatcher.RemoveListener("ControlWaterCurtain", ControlCurtain); } } public class CurtainData { public long id; public bool on; }