void Start() { grid = Grid.instance; unitsStore = UnitsStore.instance; unitManager = UnitManager.instance; cameraMotor = Camera.main.GetComponent <CameraMotor>(); turnStartText = GameObject.FindObjectOfType <TurnStartText>(); currentTeam = teams[0]; // attacker moves first ShowTeamTurnUI(); // assuming for now that there are two teams only and they have random units // TODO: Teams should be inserted from outside of the script (probably by UI on previous screen) int unitsN = 5; foreach (Team t in teams) { for (int i = 0; i < unitsN; i++) { int rndUnitIndex = random.Next(unitsStore.awailableUnits.Length); t.storedUnits.Add(unitsStore.awailableUnits[rndUnitIndex]); } } int attackerNodeX = grid.gridSizeX / 2 - teams[0].storedUnits.Count / 2; int attackerNodeY = 1; PlaceTeamUnits(teams[0], attackerNodeX, attackerNodeY); int defenderNodeX = grid.gridSizeX / 2 - teams[1].storedUnits.Count / 2; int defenderNodeY = grid.gridSizeY - 2; PlaceTeamUnits(teams[1], defenderNodeX, defenderNodeY); foreach (Unit u in teams[1].units) { u.RotateTo(u.transform.position); } FocusCameraOnTeam(currentTeam); }
void Awake() { instance = this; }