public void Launch(Missile missile, LaunchCode code, UsedLaunchCodes usedCodes) { if (code.isValidCode() && !usedCodes.Contains(code)) { missile.Launch(); usedCodes.Add(code); } else { missile.Disable(); } }
private void OnTriggerEnter2D(Collider2D collision) { if (collision.gameObject.CompareTag("Missile")) { Missile missile = collision.gameObject.GetComponent <Missile>(); missile.playerWhoShot.AddScore(); missile.Disable(); SetAsDisabled(); asteroidSpawn.AddDisabledAsteroid(); asteroidSpawn.VerifyIfAllAsteroidsAreDisabled(); asteroidSpawn.InstatiatedParticles[Index].Play(); } }