public void GetDamagedBy(Color c, float damage) { float value; value = ColorableEntity.ColorCompare(this.color, c) * damage; this.life -= value; }
private void OnTriggerStay2D(Collider2D collision) { ColorableEntity ent = collision.GetComponentInChildren <ColorableEntity>(); if (collision.gameObject.CompareTag("Player") && Input.GetKeyDown("f")) { onLeverOn.Invoke(); lev.Play("LeverOn"); } else if (ent != null && ColorableEntity.ColorCompare(ent.color, this.color) > threshold) { onLeverOn.Invoke(); lev.Play("LeverOn"); } }
public void GetDamagedBy(Color c, float damage) { float value; value = ColorableEntity.ColorCompare(this.color, c) * damage; this.boss.life -= value; if (this.boss.life <= 0f) { this.myCollider.enabled = false; } HUDManager.instance.UpdateBossHealthBar(this.boss, this.boss.life); this.StartAndStopCoroutine(ref this.shakeCoroutine, this.DamageCoroutine()); }