Esempio n. 1
0
    void Update()
    {
        if (GetComponent <PlayerMode>().mode == PlayerMode.Mode.dashing)
        {
            return;
        }

        KeyMapper keyMapper = gameController.keyMapper;

        inputX = Input.GetAxis(keyMapper.GetHorizontalMov());
        inputX = Mathf.Abs(inputX) < Mathf.Epsilon ? 0f : Mathf.Sign(inputX);

        inputY = Input.GetAxis(keyMapper.GetVerticalMov());
        inputY = Mathf.Abs(inputY) < Mathf.Epsilon ? 0f : Mathf.Sign(inputY);

        input = new Vector2(inputX, inputY);
        input.Normalize();

        rb.velocity = input * speed;

        animator.SetFloat("InputX", inputX);
    }