예제 #1
0
    void HandleMovementInput(PlayerMovementComponent move)
    {
        InputSingleton input = InputSingleton.GetLocalInputComponent();

        if (input != null)
        {
            switch (move.State)
            {
            case MovementState.Idle:
                if (input.IsInputActivated())
                {
                    if (input.Jump)
                    {
                        ChangeXZVelocityByInput(move, input.InputAxis);
                        move.EnterState(MovementState.Jump);
                    }
                    else if (input.InputAxis != Vector3.zero)
                    {
                        ChangeXZVelocityByInput(move, input.InputAxis);
                        move.EnterState(MovementState.Move);
                    }
                }
                break;

            case MovementState.Move:
                if (input.IsInputActivated())
                {
                    if (input.Jump)
                    {
                        ChangeXZVelocityByInput(move, input.InputAxis);
                        move.EnterState(MovementState.Jump);
                    }
                    else
                    {
                        ChangeXZVelocityByInput(move, input.InputAxis);
                    }
                }
                else
                {
                    move.EnterState(MovementState.Idle);
                }

                break;

            case MovementState.Jump:
                ChangeXZVelocityByInput(move, input.InputAxis);
                if (move.cc.isGrounded && move.velocity.y < 0)
                {
                    move.EnterState(MovementState.Idle);
                }
                break;

            default:
                Debug.LogError("HandleMovementInput: Uncaught movement system state");
                break;
            }
        }
    }
예제 #2
0
 public override void Update()
 {
     if (input == null)
     {
         input = InputSingleton.GetLocalInputComponent();
     }
     if (input != null)
     {
         HandleLocalSkills();
     }
 }
예제 #3
0
    void HandleInput()
    {
        if (input == null)
        {
            input = InputSingleton.GetLocalInputComponent();
        }
        if (input != null)
        {
            Vector3 inputAxis = new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical"));
            inputAxis       = Vector3.ClampMagnitude(inputAxis, 1.0f);
            input.InputAxis = inputAxis;
            input.Jump      = Input.GetKeyDown(KeyCode.Space);
            input.MousePos  = Input.mousePosition;

            input.Skills.Clear();
            GetSkillInput(SkillEnum.Tower, KeyCode.F);
        }
    }
예제 #4
0
 void Awake()
 {
     LocalInput = this;
     InitData();
 }