protected void Awake() { enemyAI = GameObject.FindObjectOfType <EnemyAi>(); tm = Object.FindObjectOfType <Turnmanager>(); enemyAI.strategy = this.strategy; #region shippositions PShipPos = new Transform[5]; CShipPos = new Transform[5]; //find all the positions for the ships in the scene GameObject[] playerShipPositions = GameObject.FindGameObjectsWithTag("PlayerShipPositions"); GameObject[] computerShipPositions = GameObject.FindGameObjectsWithTag("ComputerShipPositions"); //get the transform.positions from these gameobjects to load the ships from the fleet into the scene for (int i = 0; i < playerShipPositions.Length; i++) { PShipPos[i] = playerShipPositions[i].transform; CShipPos[i] = computerShipPositions[i].transform; } #endregion for (int i = 0; i < cShipsToLoad.Count;) { GameObject shipToAdd = GameObject.Instantiate(cShipsToLoad[i]); shipToAdd.name = "computers " + shipToAdd.GetComponent <Ship>().GetType().ToString() + " " + i.ToString(); enemyAI.hangar.AddShipToFleet(shipToAdd); shipToAdd.SetActive(false); i++; } }
void Start() { this.tm = FindObjectOfType <Turnmanager>(); }