void OnCollisionEnter2D(Collision2D coll) { if (!isHit) { Debug.Log(coll.gameObject.tag); switch (coll.gameObject.tag) { case "Core": if (engineS.currentHp > 0) { engineS.TakeDamage(damage); } if (gunS.currentHp > 0) { gunS.TakeDamage(damage); } if (jetS.currentHp > 0) { jetS.TakeDamage(damage); } break; case "Engine Part": if (engineS.currentHp > 0) { engineS.TakeDamage(damage); } break; case "Gun Part": if (gunS.currentHp > 0) { gunS.TakeDamage(damage); } break; case "Jet Part": if (jetS.currentHp > 0) { jetS.TakeDamage(damage); } break; case "Player": playerManager.StartCounter(true, 3f); break; } DestroyEnemy(); isHit = true; enemymovement.ResetCD(); enemymovement.enabled = false; } }
//-------------------------------------------// // CUSTOM ZONE // //-------------------------------------------// void RegressionEffect(engineController enginePart, coreGunController coreGunPart, jetController jetPart) { EngineHpEffect(); enginePart.TakeDamage(baseRegressionHpRatio * Time.deltaTime); coreGunPart.TakeDamage(regressionHpRatio * Time.deltaTime); jetPart.TakeDamage(regressionHpRatio * Time.deltaTime); }