Example #1
0
    void Update()
    {
        if (myWeapon == null)
        {
            return;
        }

        if (Input.GetButton("Fire1"))
        {
            //If weapon is actually shot recoil is applied
            if (MyWeapon.TriggerDown())
            {
                CheckHit();
                ApplyRecoil();
            }
        }
        else if (Input.GetButtonUp("Fire1"))
        {
            MyWeapon.TriggerUp();
        }
        else if (Input.GetKeyDown(KeyCode.R))
        {
            MyWeapon.Reload();
        }
        HUDManagment.SetWeaponInfo(myWeapon.weaponName, (int)myWeapon.shotsInMag, (int)myWeapon.shotsTotal);
        HUDManagment.SetFireMode(myWeapon.singleShot ? FireMode.Single : FireMode.Automatic);
        HUDManagment.SetCrosshair(true);
    }
 public void Drop()
 {
     phy.isKinematic = false;
     if (col_item)
     {
         col_item.enabled = true;
     }
     this.enabled = true;
     phy.velocity = PlayerInfo.Phy.velocity;
     phy.AddForce(transform.localToWorldMatrix * dropforce, ForceMode.Impulse);
     Invoke("ActivatePickUp", pickUpCooldown);
     HUDManagment.SetWeaponInfo("None", 0, 0);
     HUDManagment.SetCrosshair(false);
 }