Beispiel #1
0
        async private Task NewWaitForTask(IInteractableController _interactableController, PlayerStates playerState)
        {
            int nodeID;

            while (stateMachine.GetPlayerState() == this.currentStateType)
            {
                nodeID = playerService.GetTargetNode();
                if (nodeID != -1)
                {
                    //bool inRange = playerService.CheckForRange(nodeID);
                    bool inRange = _interactableController.CanTakeAction(playerService.GetPlayerNodeID(), nodeID);
                    if (inRange)
                    {
                        stateMachine.ChangePlayerState(playerState, PlayerStates.NONE);
                        _interactableController.TakeAction(nodeID);
                        stateMachine.ChangePlayerState(PlayerStates.END_TURN, PlayerStates.NONE);

                        playerService.ChangeToEnemyState();
                        break;
                    }
                    else
                    {
                        await new WaitForEndOfFrame();
                    }
                }
                else
                {
                    await new WaitForEndOfFrame();
                }
            }
        }