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

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

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