Exemple #1
0
        private void Awake()
        {
            _healthText = GetComponent <Text>();
            _player     = FindObjectOfType <Player.Player>();

            _healthText.text = _player.Health.ToString();

            _player.OnHit += HandleOnHit;
        }
Exemple #2
0
 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>();
 }
Exemple #4
0
 void Start()
 {
     player = GetComponent<Player>();
     playerHealth = GetComponent<PlayerHealth>();
 }