private void OnCollisionEnter2D(Collision2D col) { //Debug.Log(col.gameObject.transform.name); if (col.gameObject.transform.name == "Player") { // получаем здоровье игрока var health = GameManager.Instance.healthContainer[col.gameObject]; health.takeHit(damage); PlatformerTools.ShowHealthBar(col.gameObject); } }
public void SetDamage() { if (health != null) { health.takeHit(damage); if (health.HealthCount > 0 && collisionObject) { PlatformerTools.ShowHealthBar(collisionObject); } } collisionObject = null; health = null; }
private void OnCollisionEnter2D(Collision2D col) { if (GameManager.Instance.healthContainer.ContainsKey(col.gameObject)) { health = GameManager.Instance.healthContainer[col.gameObject]; health.takeHit(damage); //Если есть еще хп, показываем хелсбар if (health.HealthCount > 0) { PlatformerTools.ShowHealthBar(col.gameObject); } } }