private void Awake() { //IMessage.MsgDispatcher.RegisterMsg(this, (int)MsgTestType.A, Condition, Action); //gameObject.SetActive(false); MsgDispatcher.RegisterMsg(GetComponent <GameUnit.GameUnit>().GetMsgReceiver(), (int)MsgTestType.UnitMoving, Condition, Action); //IMessage.MsgDispatcher.RegisterMsg(this, (int)TriggerType.UpdateSource, Condition, UpdateSource);//初始or更新资源 //IMessage.MsgDispatcher.RegisterMsg(this, (int)TriggerType.BP, Condition, BattlePresent);//战斗回合开始 }
private void Start() { unityEventUpdateResource.AddListener(() => { MsgDispatcher.SendMsg((int)MessageType.UpdateSource); }); unityEventBattlePresent.AddListener(() => { MsgDispatcher.SendMsg((int)MessageType.BP); }); unityEventUpdateResource.Invoke(); }