public void SetUpCannon() { CannonManager cannonManager = activePlayer.GetComponent <CannonManager> (); if (cannonManager.cannonsCreated < cannonManager.cannonNumber) { cannonToDeploy = cannonManager.CreateCannon(this.transform); } }
void CreateCannons(GameObject player) { DeckManager deckManager = player.GetComponent <DeckManager> (); CannonManager cannonManager = player.GetComponent <CannonManager> (); Vector3[] positions = GetCannonPositions(player); for (int i = 0; i < cannonManager.cannonNumber; i++) { GameObject cannonToDeploy = cannonManager.CreateCannon(player.transform); int xPos = (int)positions [i].x; int zPos = (int)positions [i].z; cannonToDeploy.GetComponent <Cannon>().PlaceCannon(deckManager.RetrieveTile(xPos, zPos)); cannonManager.cannonsCreated += 1; } }