private void Awake() { _healthText = GetComponent <Text>(); _player = FindObjectOfType <Player.Player>(); _healthText.text = _player.Health.ToString(); _player.OnHit += HandleOnHit; }
public void ReceiveDamage(Player shooter, float value) { if (isLocalPlayer) { health -= value; CmdSetHealth(health); if (health <= 0) { GetComponent<Player>().AddDeath(shooter.netId); Die(); Camera.main.GetComponent<CameraScript>().target = shooter.transform; } } }
void Start() { player = FindObjectOfType<Player.Player>(); }
void Start() { player = GetComponent<Player>(); playerHealth = GetComponent<PlayerHealth>(); }