November 2018
Beginner
246 pages
5h 23m
English
As a final step, we need to instruct the GameManager script to spawn a player tank and an AI tank.
public GameObject m_TankPrefab; // Reference to the prefab the players will control. public GameObject m_TankAIPrefab; // Reference to the prefab the AI will control.
private void SpawnAllTanks() { // For all the tanks... for (int i = 0; i < m_Tanks.Length; i++) { if (i == m_Tanks.Length - 1) { // If last tank, it's AI m_Tanks[i].m_Instance = Instantiate(m_TankAIPrefab, m_Tanks[i].m_SpawnPoint.position, m_Tanks[i].m_SpawnPoint.rotation) as GameObject; m_Tanks[i].m_PlayerNumber ...Read now
Unlock full access