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);
    }
Example #2
0
 // Update is called once per frame
 void Update()
 {
     if (HUDTestEnabled)
     {
         if (testConnectionDisplayMain)
         {
             HUDManagment.SetConnectionStatus(connectionStatus);
         }
         if (testWeaponDisplayMain)
         {
             HUDManagment.SetWeaponInfo(weaponname, currentAmmo, maxAmmo);
             HUDManagment.SetFireMode(fireMode);
         }
         if (testHealthDisplayMain)
         {
             HUDManagment.SetPlayerInfo(playerName);
             HUDManagment.SetPlayerHealth(currentHealth);
             HUDManagment.SetPlayerArmor(currentAmour);
             HUDManagment.SetPlayerColor(playerColor);
         }
     }
 }