private void ChangeStateToWaitState() { TurnMgr_State_ nextState = new TurnMgr_PlayerBegin_(owner, unit); owner.stateMachine.ChangeState( new TurnMgr_WaitSingleEvent_(owner, unit, EventMgr.Instance.onUnitRunExit, nextState, (param) => ((UnitStateEvent)param)._owner == unit, OnWaitEnter, OnWaitExecute, OnWaitExit), StateMachine <TurnMgr> .StateTransitionMethod.JustPush); }
void UseItem(Item item) { turnMgr = gameMgr._turnMgr; TurnMgr_State_ nextState = new TurnMgr_PlayerBegin_(turnMgr, turnMgr.turns.Peek()); turnMgr.stateMachine.ChangeState( new TurnMgr_WaitSingleEvent_(turnMgr, turnMgr.turns.Peek(), EventMgr.Instance.onUnitIdleEnter, nextState), StateMachine <TurnMgr> .StateTransitionMethod.JustPush); ItemCommand itemCommand; if (ItemCommand.CreateCommand(turnMgr.turns.Peek(), item, out itemCommand)) { turnMgr.turns.Peek().EnqueueCommand(itemCommand); } }
private void AttackOnClickedCube() { TurnMgr_State_ nextState = new TurnMgr_PlayerBegin_(owner, unit); owner.stateMachine.ChangeState( new TurnMgr_WaitSingleEvent_(owner, unit, EventMgr.Instance.onUnitIdleEnter, nextState, (param) => ((UnitStateEvent)param)._owner == unit), StateMachine <TurnMgr> .StateTransitionMethod.JustPush); unit.StopBlink(); List <Cube> cubesToAttack = MapMgr.Instance.GetCubes(unit.basicAttackSplash, cubeClicked); AttackCommand attackCommand; if (AttackCommand.CreateCommand(unit, cubeClicked, out attackCommand)) { unit.EnqueueCommand(attackCommand); } }
private void UseOnClickedCube() { TurnMgr_State_ nextState = new TurnMgr_PlayerBegin_(owner, unit); owner.stateMachine.ChangeState( new TurnMgr_WaitSingleEvent_(owner, unit, EventMgr.Instance.onUnitIdleEnter, nextState, (param) => ((UnitStateEvent)param)._owner == unit), StateMachine <TurnMgr> .StateTransitionMethod.JustPush); unit.StopBlink(); List <Cube> cubesToUseSplash = MapMgr.Instance.GetCubes(_item.useSplash, cubeClicked); ItemCommand itemCommand; if (ItemCommand.CreateCommand(unit, _item, cubesToUseSplash, out itemCommand)) { unit.EnqueueCommand(itemCommand); } }
=> true; // 범위내의 모든 큐브에 Cast가능합니다. private void CastSkillOnCube(Cube cubeClicked) { this.cubeClicked = cubeClicked; TurnMgr_State_ nextState = new TurnMgr_PlayerBegin_(owner, unit); owner.stateMachine.ChangeState( new TurnMgr_WaitSingleEvent_( owner, unit, EventMgr.Instance.onUnitSkillExit, nextState, (param) => ((UnitStateEvent)param)._owner == unit), StateMachine <TurnMgr> .StateTransitionMethod.JustPush); unit.StopBlink(); SkillCommand skillCommand; if (SkillCommand.CreateCommand(unit, cubeClicked, out skillCommand)) { unit.EnqueueCommand(skillCommand); } }