Пример #1
0
 private void Awake()
 {
     spriteRenderer = GetComponent <SpriteRenderer>();
     collider       = GetComponent <BoxCollider2D>();
     ac             = GetComponent <AudioController>();
     health         = new NumericalResource(ResourceType.Health, 0, maxHealth);
     IsAlive        = true;
     _inAnimation   = false;
 }
Пример #2
0
 public void bindHealthBar(NumericalResource health)
 {
     if (this.health != null)
     {
         this.health.OnResourceUpdated -= updateHealthBarUI;
     }
     this.health = health;
     if (this.health != null)
     {
         this.health.OnResourceUpdated += updateHealthBarUI;
         slider.maxValue = health.max;
         slider.value    = health.quantity;
     }
     else
     {
         slider.value = 0;
     }
 }
Пример #3
0
 public void bindPowerBar(NumericalResource power)
 {
     if (this.power != null)
     {
         this.power.OnResourceUpdated -= updatePowerBarUI;
     }
     this.power = power;
     if (this.power != null)
     {
         this.power.OnResourceUpdated += updatePowerBarUI;
         slider.maxValue = power.max;
         slider.value    = power.quantity;
     }
     else
     {
         slider.value = 0;
     }
 }