Esempio n. 1
0
    void HandleInput()
    {
        if (Input.GetButton("Fire1"))
        {
            mGunMotor.Fire();
            if (AudioManager.instance.getIsPlaying("PlayerFire") == false)
            {
                AudioManager.instance.playSound("PlayerFire");
            }
        }
        if (Input.GetButtonUp("Fire1"))
        {
            if (AudioManager.instance.getIsPlaying("PlayerFire") == true)
            {
                AudioManager.instance.pauseSound("PlayerFire");
            }
        }

        Vector3 mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition) + new Vector3(0, 0, 3);

        mousePos.x         = Mathf.Clamp(mousePos.x, -3.8f, 3.8f);
        mousePos.y         = Mathf.Clamp(mousePos.y, -4.7f, 4.8f);
        transform.position = mousePos;


        //Vector2 mouseVel = new Vector2(Input.GetAxis("Mouse X"), Input.GetAxis("Mouse Y"));
        //mRigidbody2D.velocity = mouseVel;
    }
Esempio n. 2
0
 void Update()
 {
     if (!mPaused)
     {
         if (mShouldBeFiring && mHealth.mCurrentHealth >= 0)
         {
             Aim();
             mGunMotor.Fire();
         }
     }
 }
Esempio n. 3
0
 void Update()
 {
     if (!mPaused)
     {
         if (mShouldBeFiring)
         {
             Aim();
             mGunMotor.Fire();
         }
     }
 }
Esempio n. 4
0
 public void Aim(Vector2 _leftStick, Vector2 _rightStick)
 {
     if (!parrying)
     {
         if (_rightStick != Vector2.zero)
         {
             SoftLock(_rightStick);
             transform.rotation = Quaternion.Euler(0, 0, facingDirection);
             mGunMotor.Fire();
         }
         else if (_leftStick != Vector2.zero)
         {
             _leftStick.x    = -_leftStick.x;
             facingDirection = Vector3.Angle(_leftStick, Vector2.up);
             if (_leftStick.x < 0)
             {
                 facingDirection = -facingDirection;
             }
             transform.rotation = Quaternion.Euler(0, 0, facingDirection);
         }
     }
 }