// Update is called once per frame
 void Update()
 {
     // Horizontal Axis - Cycle through cat models
     if (storedInput.GetAxisRaw(MappedAxis.MenuHorizontal) < 0)
     {
         if (isAxisInUse == false)
         {
             // Call your event function here.
             isAxisInUse = true;
             getPrevKat();
         }
     }
     if (storedInput.GetAxisRaw(MappedAxis.MenuHorizontal) > 0)
     {
         if (isAxisInUse == false)
         {
             // Call your event function here.
             isAxisInUse = true;
             getNextKat();
         }
     }
     if (storedInput.GetAxisRaw(MappedAxis.MenuHorizontal) == 0)
     {
         isAxisInUse = false;
     }
 }
Esempio n. 2
0
    private void Keyboard()
    {
        float mouseX = InputDevice.GetAxisRaw(MappedAxis.AimX);
        float mouseY = InputDevice.GetAxisRaw(MappedAxis.AimY);

        var mousePos  = Camera.main.ScreenToWorldPoint(new Vector2(mouseX, mouseY));
        var aimVector = Vector2.zero;

        if (AttachedObject == null)
        {
            aimVector = mousePos - transform.position;
        }
        else
        {
            aimVector = mousePos - AttachedObject.transform.position;
        }

        AimReticle(aimVector);

        if (InputDevice.GetButtonDown(MappedButton.ChangeGrav))
        {
            FlipGravity();
        }

        if (InputDevice.GetIsAxisTappedPos(MappedAxis.ChangeGravAxis))
        {
            ChangeGravityTowardsDir(Vector2.up);
        }

        if (InputDevice.GetIsAxisTappedNeg(MappedAxis.ChangeGravAxis))
        {
            ChangeGravityTowardsDir(Vector2.down);
        }


        if (InputDevice.GetButtonDown(MappedButton.ShootGravGun))
        {
            ShootGravityGun(aimVector, ProjectileControllerType.Normal);
        }

        if (InputDevice.GetButtonDown(MappedButton.Special))
        {
            DoSpecial(aimVector);
        }
    }
Esempio n. 3
0
    private void Gamepad()
    {
        float rightSitckX = InputDevice.GetAxisRaw(MappedAxis.AimX);
        float rightSitckY = InputDevice.GetAxisRaw(MappedAxis.AimY);

        Vector2 aimDir = new Vector2(rightSitckX, rightSitckY);

        if (aimDir == Vector2.zero)
        {
            aimDir = _lastAimDir;
        }
        else
        {
            _lastAimDir = aimDir;
        }

        AimReticle(aimDir);

        if (InputDevice.GetIsAxisTappedPos(MappedAxis.ChangeGravAxis, .5f))
        {
            ChangeGravityTowardsDir(Vector2.up);
        }

        if (InputDevice.GetIsAxisTappedNeg(MappedAxis.ChangeGravAxis, -.5f))
        {
            ChangeGravityTowardsDir(Vector2.down);
        }

        if (InputDevice.GetIsAxisTappedPos(MappedAxis.ChangeGrav) && InputDevice.GetAxis(MappedAxis.ChangeGrav) > 0)
        {
            FlipGravity();
        }

        if (InputDevice.GetIsAxisTappedPos(MappedAxis.ShootGravGun) && aimDir.magnitude > 0)
        {
            ShootGravityGun(aimDir, ProjectileControllerType.Normal);
        }

        if (InputDevice.GetButtonDown(MappedButton.Special))
        {
            DoSpecial(aimDir);
        }
    }