Esempio n. 1
0
    /**
     * @pre: N/A.
     * @post: Commands relating to equiped Receiver should be parsed.
     * @param: None.
     * @return: None.
     */


    void Attack()
    {
        if (defaultWeapon != null)
        {
            if (Input.GetAxisRaw("Fire") == 1 && fireHeld == 0)
            {
                Debug.Log(transform.rotation);
                // Quaternion derp = Quaternion.Euler(0, transform.rotation.y, 0);
                Quaternion derp = Quaternion.Euler(cam.transform.eulerAngles.x, transform.eulerAngles.y, 0);
                equipedWeapon.Fire(transform.position, derp);
                weaponCheck.Invoke();
            }
            else if (Input.GetAxisRaw("Fire") == 1 && fireHeld != 0)
            {
                Quaternion derp = Quaternion.Euler(cam.transform.eulerAngles.x, transform.eulerAngles.y, 0);
                equipedWeapon.HoldFire(transform.position, derp);
                holdFire = true;
                weaponCheck.Invoke();
            }
            else if (Input.GetAxisRaw("Fire") == 0 && holdFire)
            {
                equipedWeapon.ReleaseHoldFire();
                holdFire = false;
                weaponCheck.Invoke();
            }

            if (Input.GetAxisRaw("AltFire") == 1 && altFireHeld == 0)
            {
                equipedWeapon.AltFire();
                weaponCheck.Invoke();
            }

            if (Input.GetAxisRaw("ADS") == 1 && aimHeld == 0)
            {
                equipedWeapon.ADS();
                weaponCheck.Invoke();
            }

            if (Input.GetAxisRaw("Reload") == 1 && reloadHeld == 0)
            {
                equipedWeapon.ReloadMag();
                weaponCheck.Invoke();
            }
        }
    }