Example #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();
                }
            }
        }
Example #2
0
        async public void PerformInteractableAction(IInteractableController _interactableController)
        {
            int nodeID = playerService.GetTargetNode();

            switch (_interactableController.GetInteractablePickup())
            {
            case InteractablePickup.AMBUSH_PLANT:
                await ChangePlayerState(PlayerStates.AMBUSH, PlayerStates.NONE);

                _interactableController.TakeAction(playerNodeID);
                break;

            case InteractablePickup.BONE:
                pathService.ShowThrowableNodes(playerNodeID);
                playerService.SetTargetTap(-1);
                await ChangePlayerState(PlayerStates.WAIT_FOR_INPUT, PlayerStates.THROWING, _interactableController);

                break;

            case InteractablePickup.BREIFCASE:
                await ChangePlayerState(PlayerStates.IDLE, PlayerStates.NONE);

                _interactableController.TakeAction(playerNodeID);
                await new WaitForEndOfFrame();
                break;

            case InteractablePickup.COLOR_KEY:
                await ChangePlayerState(PlayerStates.IDLE, PlayerStates.NONE);

                _interactableController.TakeAction(playerNodeID);

                break;

            case InteractablePickup.DUAL_GUN:
                await ChangePlayerState(PlayerStates.IDLE, PlayerStates.NONE);

                _interactableController.TakeAction(playerNodeID);

                break;

            case InteractablePickup.GUARD_DISGUISE:
                await ChangePlayerState(PlayerStates.DISGUISE, PlayerStates.NONE);

                _interactableController.TakeAction(playerNodeID);

                break;

            case InteractablePickup.SNIPER_GUN:
                playerService.SetTargetTap(-1);
                currentPlayerView.PlayAnimation(PlayerStates.SHOOTING);
                await ChangePlayerState(PlayerStates.WAIT_FOR_INPUT, PlayerStates.SHOOTING, _interactableController);

                break;

            case InteractablePickup.STONE:
                pathService.ShowThrowableNodes(playerNodeID);
                playerService.SetTargetTap(-1);
                await ChangePlayerState(PlayerStates.WAIT_FOR_INPUT, PlayerStates.THROWING, _interactableController);

                break;

            case InteractablePickup.TRAP_DOOR:
                playerService.SetTargetTap(-1);
                await ChangePlayerState(PlayerStates.WAIT_FOR_INPUT, PlayerStates.UNLOCK_DOOR, _interactableController);

                break;
            }
            await new WaitForEndOfFrame();
        }