public void OnTriggerEnter2D(Collider2D collider) { if (collider.name == "PlayerCharacter") { collider.gameObject.GetComponent <Rigidbody2D>().velocity = new Vector3(0f, 0f, 0f); collider.gameObject.GetComponent <Rigidbody2D>().velocity = throwDirection * throwForce; } if (collider.tag == "Enemy") { Destroy(collider.gameObject, 0f); scoreScript.AddToScore(10); } }
public void NormalEngage(int index) { switch (index) { case 1: //serce int random = Random.Range(1, 3); if (random == 1) //Mystery Air Support { infoGenerator.MakeInfoObject("Mystery Air Support"); float xMysteryAirSupport = Camera.main.ScreenToWorldPoint(new Vector3(0, 0, 10)).x; Instantiate(MysteryAirSupport, new Vector3(Random.Range(xMysteryAirSupport, -xMysteryAirSupport), 5, 0), Quaternion.identity, transform); } else //Shield Air Support { infoGenerator.MakeInfoObject("Shield Air Support"); float xShieldAirSupport = Camera.main.ScreenToWorldPoint(new Vector3(0, 0, 10)).x; Instantiate(ShieldAirSupport, new Vector3(Random.Range(xShieldAirSupport, -xShieldAirSupport), 5, 0), Quaternion.identity, transform); } break; case 2: //sun infoGenerator.MakeInfoObject("+200 score"); score.AddToScore(200); break; case 4: //clock infoGenerator.MakeInfoObject("+200 score"); score.AddToScore(200); break; case 3: //gearwheel int randomGearwheel = Random.Range(1, 3); if (randomGearwheel == 1) //Healing Point { infoGenerator.MakeInfoObject("Healing Point"); spawner.SpawnHealingPoint(); } else //Antimissile { score.AddToScore(100); infoGenerator.MakeInfoObject("Antimissile"); spawner.SpawnAntimissile(); } break; case 5: //boom int randomBoom = Random.Range(0, 34); if (randomBoom < 2) //Stars Festival { infoGenerator.MakeInfoObject("Stars Festival"); GetComponent <BubbleGeneratorScript>().SetAlternativeMode(true, false, true); StartCoroutine(StopEffect(15, 100200030)); } else if (randomBoom < 4) //Extra Points { score.AddPercentToScore(5); infoGenerator.MakeInfoObject("Extra Points\n+5% score"); } else if (randomBoom < 12) //Mega Star Bubble { infoGenerator.MakeInfoObject("Mega Star Bubble"); Instantiate(megaBubble, new Vector3(Random.Range(-2.5f, 2.5f), -5, 0), Quaternion.identity, transform); } else if (randomBoom < 27) //Salute { infoGenerator.MakeInfoObject("Salute"); for (int i = 0; i < 3; i++) { spawner.MissileSpawn(); } } else //The Furious Sheep { infoGenerator.MakeInfoObject("The Furious Sheep"); Instantiate(FuriousSheep); } break; case 6: //lightning infoGenerator.MakeInfoObject("300 score"); score.AddToScore(300); break; case 7: //M spawner.MpBuble(true); break; case 8: //P spawner.MpBuble(false); break; case 9: //star score.AddToScore(10); infoGenerator.MakeInfoObject("+1 Star\n+10 score"); player.GetComponent <PlayerHPSystem>().ChangeOwnedStars(1); break; case 10: //dawniej combobreaker - blackhole infoGenerator.MakeInfoObject("Black Hole"); Instantiate(blackHole, new Vector3(Random.Range(-3.5f, 3.5f), Random.Range(-2, 2f), 0), Quaternion.identity); break; case 12: //missile infoGenerator.MakeInfoObject("Missile"); spawner.MissileSpawn(); break; case 13: //UFO Attack infoGenerator.MakeInfoObject("UFO Attack"); Instantiate(ufo); break; case 16: infoGenerator.MakeInfoObject("+10 Star"); player.GetComponent <PlayerHPSystem>().ChangeOwnedStars(10); break; case 17: int randomSupport = Random.Range(1, 4); if (randomSupport < 2) { infoGenerator.MakeInfoObject("Extra Shield"); player.GetComponent <PlayerHPSystem>().AddSuperShield(); } else if (randomSupport < 2) { score.AddToScore(200); infoGenerator.MakeInfoObject("+200 score"); } else { infoGenerator.MakeInfoObject("+10 Star"); player.GetComponent <PlayerHPSystem>().ChangeOwnedStars(10); } break; case 18: infoGenerator.MakeInfoObject("Extra Shield"); player.GetComponent <PlayerHPSystem>().AddSuperShield(); break; default: //Debug.Log("Nieznany babelek!"); break; } }