示例#1
0
 public override void EnterState()
 {
     movementStateMachine.ChangeState(MovementStates.Frozen);
     cameraStateMachine.ChangeState(CameraStates.PreIdle);
     respawnStartTime = Time.time;
     startingPosition = player.transform.position;
 }
示例#2
0
    void Awake()
    {
        controller = GetComponent <Controller2D>();

        movementMachine = new MovementStateMachine();
        movementMachine.ChangeState(new LiquidState(), this);
    }
示例#3
0
 public void HandleState()
 {
     switch (ActionState)
     {
     case PlayerAction.move:
         // jump
         stateMachine.ChangeState(character.MovingState);
         break;
     }
 }
示例#4
0
    }//Start

    void Update()
    {
        Vector2 directionalInput = new Vector2(Input.GetAxisRaw("Horizontal"), Input.GetAxisRaw("Vertical"));

        playerMovementMachine.CurrentForm.SetDirectionalInput(directionalInput);

        if (Input.GetKeyDown(KeyCode.Space))
        {
            playerMovementMachine.CurrentForm.OnJumpInputDown();
        }//if
        if (Input.GetKeyUp(KeyCode.Space))
        {
            playerMovementMachine.CurrentForm.OnJumpInputUp();
        }//if

        // STATE SWITCHING <<<<<

        if (Input.GetKeyDown(KeyCode.G))
        {
            Debug.Log("Entering gas state");
            playerMovementMachine.ChangeState(new GasState(), player);
        }

        if (Input.GetKeyDown(KeyCode.L))
        {
            Debug.Log("Entering liquid state");
            playerMovementMachine.ChangeState(new LiquidState(), player);
        }

        if (Input.GetKeyDown(KeyCode.S))
        {
            Debug.Log("Entering solid state");
            playerMovementMachine.ChangeState(new SolidState(), player);
        }

        // STATE SWITCHING >>>>>
    }//Update
 public override void EnterState()
 {
     teleport.BeginTeleport(targetTriggerArea.getNextTarget());
     movementStateMachine.ChangeState(MovementStates.Frozen);
     cameraStateMachine.ChangeState(CameraStates.PreIdle);
 }
示例#6
0
 public override void EnterState()
 {
     movementStateMachine.ChangeState(MovementStates.InputEnabled);
 }