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); }
// ------------------------- Netzwerk ------------------------- private void Client_OnPlayerUpdate(CCC_Client.DeserializedPlayer player) { if (player.ID == PlayerID) { LifeEnergy = player.Health; HUDManagment.SetPlayerHealth(player.Health); } }
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); }
private void SendPacket(CCC_Packet packet) { if (client.Connected) { try { client.Send(packet); } catch (Exception) { HUDManagment.SetConnectionStatus(ConnectionStatus.Lost); } } else { HUDManagment.SetConnectionStatus(ConnectionStatus.NotConnected); } }
// 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); } } }
private void OnTimeout(byte[] data) { HUDManagment.SetConnectionStatus(ConnectionStatus.TimeOut); }