private void OnTriggerEnter2D(Collider2D collision) { if (collision.gameObject.name == "EnemyTriangle(Clone)") { hitSource.Play(); score.scoreUpdate(1); Destroy(collision.gameObject); health.updateCoreHealth(5); enemyManagement.enemyTriangleCount--; } else if (collision.gameObject.name == "EnemyOctagonPurple(Clone)") { hitSource.Play(); score.scoreUpdate(2); Destroy(collision.gameObject); health.updateCoreHealth(20); enemyManagement.enemyOctagonPurpleCount--; } else if (collision.gameObject.name == "EnemyHeartPink(Clone)") { hitSource.Play(); score.scoreUpdate(3); Destroy(collision.gameObject); health.updateCoreHealth(20); enemyManagement.enemyHeartPinkCount--; } else if (collision.gameObject.name == "EnemyCircleMaroon(Clone)") { hitSource.Play(); EnemyCircleMaroon enemy = collision.GetComponent <EnemyCircleMaroon>(); score.scoreUpdate(enemy.pointValue); Destroy(collision.gameObject); health.updateCoreHealth(25); enemyManagement.enemyCircleMaroonCount--; } EnemyBullet enemyBullet = collision.GetComponent <EnemyBullet>(); if (enemyBullet != null) { hitSource.Play(); health.updateCoreHealth(5); enemyBullet.DestroyBullet(); } }
public void HealthManagementUpdateCoreHealthTest() { var healthManagement = new HealthManagement(); int originalHealth = 100; healthManagement.coreHealth = originalHealth; int damage = 10; healthManagement.updateCoreHealth(damage); //Health of core is expected to be decreased by damage Assert.That(healthManagement.coreHealth, Is.EqualTo(originalHealth - damage)); }
public void healthRestore() { health.updateCoreHealth(-10); }