public void SpawnArcher() { if (map == null) { map = GameObject.FindObjectOfType <Map>(); } if (cam == null) { cam = GameObject.FindObjectOfType <CameraController>(); } if (map.AllPlayersCreated()) { if (cam.selectat) { tutorial.OpenPanel("Archer Spawn Selected, choose one of your free hexes to spawn your archer."); cam.ChangeCameraModeToSpawnArcher(); } } else { tutorial.OpenPanel("Your first unit will be an archer, select the a hex to be your capital."); map.UnitToSpawn = 0; } }
void Update_CreatePlayers() { if (map.AllPlayersCreated() || map.UnitToSpawn == -1) { Update_CurrentFunction = Update_DetectModeStart; } else if (Input.GetMouseButtonUp(0) && !DoIClickButton()) { Hex hex = MouseToHex(); if (hex != null && hex.CanFirstUnitSpawnHere(map.getCurrentPlayer())) { int currentPlayer = map.getCurrentPlayer(); map.createPlayer(hex); if (map.UnitToSpawn == 0) { map.SpawnFirstUnitAt(new Unit(0, 0, 1), map.ArcherPrefab, hex, map.GetPlayerI(currentPlayer)); } if (map.UnitToSpawn == 1) { map.SpawnFirstUnitAt(new Unit(0, 1, 0), map.DwarfPrefab, hex, map.GetPlayerI(currentPlayer)); } if (map.UnitToSpawn == 2) { map.SpawnFirstUnitAt(new Unit(1, 0, 0), map.HorsePrefab, hex, map.GetPlayerI(currentPlayer)); } map.UnitToSpawn = -1; } else if (hex != null) { tutorial.OpenPanel("You can't have two capitals this close too eachother, or a capital on water.You now have to reselect the unit to spawn."); map.UnitToSpawn = -1; } } }