Exemplo n.º 1
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.CompareTag("EnemyLaser"))
     {
         ProcessHit(collision);
         OnPlayerHealthChange?.Invoke();
     }
 }
Exemplo n.º 2
0
 void AnnounchHealthChange(float remainingHealth, float healthChange)
 {
     OnPlayerHealthChange?.Invoke(remainingHealth);
 }
Exemplo n.º 3
0
 /// <summary>
 /// Invoke <see cref="OnPlayerHealthChangeRequest"/>
 /// </summary>
 /// <param name="changeAmount">The amount you wish to change the player's health by</param>
 public void ChangePlayerHealthRequest(int changeAmount)
 {
     OnPlayerHealthChange?.Invoke(changeAmount);
 }
Exemplo n.º 4
0
    //public delegate void OnPlayerMaxHealthChange(float damage);
    //public static OnPlayerMaxHealthChange onPlayerMaxHealthChange; // потом

    private void Start()
    {
        onPlayerHealthChange?.Invoke(_health);
        _maxHealth = _health;
    }
Exemplo n.º 5
0
 private void AddHealth(float amount)
 {
     _health += amount;
     OnPlayerHealthChange?.Invoke();
 }