public override void RegisteMouseEvent(ref UnityAction mapEnterAction, ref UnityAction <Land, PointerEventData> mapClickAction, ref UnityAction mapExitAction) { base.RegisteMouseEvent(ref mapEnterAction, ref mapClickAction, ref mapExitAction); mapEnterAction = delegate() { _enterMap = true; }; mapClickAction = delegate(Land land, PointerEventData eventData) { MouseClickBtnLand = land; //如果点击的是左键,则进行游戏操作 if (eventData.button == PointerEventData.InputButton.Left) { CurAttackState.ClickAction(MouseClickBtnLand); SetCurSelectLandInfo(MouseClickBtnLand); } else { Cancel(); CurAttackState = AttackStateDic[AttackStateEnum.NoneAttack]; } }; mapExitAction = delegate() { _enterMap = false; }; }
void Awake() { _states = new Dictionary <AttackStateType, AttackStateBase>(); this._states.Add(AttackStateType.WAIT, new AttackStateWait(this)); this._states.Add(AttackStateType.PREPARE, new AttackStatePrepare(this)); this._states.Add(AttackStateType.AFTER, new AttackStateAfter(this)); this._currentState = this._states[AttackStateType.WAIT]; }
public override void EnterState() { base.EnterState(); if (AttackStateDic == null) { AttackStateDic = new Dictionary <AttackStateEnum, AttackStateBase>(); AttackStateDic.Add(AttackStateEnum.NoneAttack, new NoneAttackState(this)); AttackStateDic.Add(AttackStateEnum.ArmyAttack, new ArmyAttackState(this)); AttackStateDic.Add(AttackStateEnum.BombAttack, new BombAttackState(this)); AttackStateDic.Add(AttackStateEnum.CardAttack, new CardAttackState(this)); } CurAttackState = AttackStateDic[AttackStateEnum.NoneAttack]; if (BattleManager.Instance.BATTLE_EVENT_MyTurnStart != null) { BattleManager.Instance.BATTLE_EVENT_MyTurnStart(); } }
public void changeState(AttackStateType type) { // Debug.Log(type.ToString()); _currentState = _states[type]; _currentState.reset(); //todo..remove enter }