示例#1
0
    public void OnStickHold(JoystickDoubleAxis axis)
    {
        if (axis.Code == AxisCode.LeftStick)
        {
            isIdling = false;

            if (isJumping == false)
            {
                if (iswalking == false)
                {
                    if (isGrounded)
                    {
                        _animator.SetTrigger("Walk");
                        iswalking = true;
                    }
                }
            }
            if (playerGrab.isGrabbingHair != true)
            {
                float x = axis.GetAxisX();

                rb.velocity        = new Vector2(0, rb.velocity.y);
                transform.position = transform.position + new Vector3(x * moveSpeed * Time.deltaTime, 0);
            }
        }
    }
示例#2
0
    public void OnStickHold(JoystickDoubleAxis stick)
    {
        if (stick.Code == AxisCode.LeftStick && hairRB != null)
        {
            if (stick.X > 0)
            {
                if (canGoRight)
                {
                    hairRB.velocity = new Vector2(stick.X * Time.deltaTime * hairMoveSpeed, hairRB.velocity.y);
                }
                else
                {
                    hairRB.velocity = new Vector2(0, hairRB.velocity.y);
                }
            }
            else
            {
                if (canGoLeft)
                {
                    hairRB.velocity = new Vector2(stick.X * Time.deltaTime * hairMoveSpeed, hairRB.velocity.y);
                }
                else
                {
                    hairRB.velocity = new Vector2(0, hairRB.velocity.y);
                }
            }


            if (stick.Y > 0)
            {
                if (canGoUp)
                {
                    hairRB.velocity = new Vector2(hairRB.velocity.x, stick.Y * Time.deltaTime * hairMoveSpeed);
                }
                else
                {
                    hairRB.velocity = new Vector2(hairRB.velocity.x, 0);
                }
            }
            else
            {
                if (canGoDown)
                {
                    hairRB.velocity = new Vector2(hairRB.velocity.x, stick.Y * Time.deltaTime * hairMoveSpeed);
                }
                else
                {
                    hairRB.velocity = new Vector2(hairRB.velocity.x, 0);
                }
            }
        }
        else if (stick.Code == AxisCode.RightStick)
        {
            tower.MoveX(-stick.X * Time.deltaTime * towerMoveSpeed);
        }
    }
示例#3
0
 public void OnStickDeadZone(JoystickDoubleAxis stick)
 {
     if (stick.Code == AxisCode.LeftStick)
     {
         if (hairRB != null)
         {
             hairRB.velocity = new Vector2(0, 0);
         }
     }
 }
示例#4
0
 public void OnStickDeadZone(JoystickDoubleAxis axis)
 {
     if (axis.Code == AxisCode.LeftStick)
     {
         if (isJumping == false)
         {
             if (isIdling == false)
             {
                 _animator.SetTrigger("Idle");
                 isIdling  = true;
                 iswalking = false;
             }
         }
     }
 }
示例#5
0
 public void OnStickChange(JoystickDoubleAxis axis)
 {
 }