// Start is called before the first frame update void Start() { BaseAI[] aiArray = new BaseAI[] { new IljaAI(), new PondAI(), new PondAI(), new PondAI() }; for (int i = 0; i < 4; i++) { GameObject pirateShip = Instantiate(PirateShipPrefab, SpawnPoints[i].position, SpawnPoints[i].rotation); PirateShipController pirateShipController = pirateShip.GetComponent <PirateShipController>(); pirateShipController.SetAI(aiArray[i]); pirateShips.Add(pirateShipController); } }
// Start is called before the first frame update void Start() { //moved the aiArray list command to outside. - Aadi. //changed the integer value of greater than i from 4 to 5. - Aadi. //Increased the size for Spawn Points section in Inspector Window. - Aadi. //Cloned the spawnpoint5 from spawnpoint4 and dragndropped it to Element 4. - Aadi. for (int i = 0; i < 5; i++) { GameObject pirateShip = Instantiate(PirateShipPrefab, SpawnPoints[i].position, SpawnPoints[i].rotation); PirateShipController pirateShipController = pirateShip.GetComponent <PirateShipController>(); pirateShipController.SetAI(aiArray[i]); pirateShips.Add(pirateShipController); if (i == 0) { pirateShip.name = "Aadi"; pirateShipController.cannonballs += 100; //pirateShip.AddComponent<PirateShipController>().PerkOne(); } if (i == 1) { //pirateShip.AddComponent<PirateShipController>().PerkTwo(); pirateShip.name = "Ruben"; } if (i == 2) { //pirateShip.AddComponent<PirateShipController>().PerkThree(); pirateShip.name = "Maxym"; } if (i == 3) { //pirateShip.AddComponent<PirateShipController>().PerkFour(); pirateShip.name = "Martin"; } if (i == 4) { //pirateShip.AddComponent<PirateShipController>().PerkFive(); pirateShip.name = "Sjoeke"; } } }