Ejemplo n.º 1
0
 void Update()
 {
     if (!startAccept)
     {
         return;
     }
     animatorController.AcceptInput(curDirection, state);
     movement.Movement(state, curDirection);
 }
Ejemplo n.º 2
0
    void setPlayerStateWithDirectionAcceleration()
    {
        Vector2         acceleration = Input.acceleration;
        PlayerDirection direction    = animatorController.Direction;
        PlayerState     state        = animatorController.State;

        if (ETCInput.GetButton("Stop"))
        {
            state = PlayerState.Idle;
        }
        else if (Mathf.Abs(acceleration.x) >= Mathf.Abs(acceleration.y))
        {
            state = PlayerState.Movement;
            if (acceleration.x < 0f)
            {
                direction = PlayerDirection.Left;
            }
            else
            {
                direction = PlayerDirection.Right;
            }
        }
        else
        {
            state = PlayerState.Movement;
            if (acceleration.y < 0f)
            {
                direction = PlayerDirection.Down;
            }
            else
            {
                direction = PlayerDirection.Up;
            }
        }
        animatorController.AcceptInput(direction, state);
        movement.Movement(state, direction);
    }
Ejemplo n.º 3
0
 public void target(Vector2 position, PlayerDirection direction, PlayerState state)
 {
     targetPosition  = position;
     targetDirection = direction;
     animatorController.AcceptInput(animatorController.Direction, state);
 }