public bool AssignSpawn(ShipController ship) { float initialSpawnSeperation = 2f * this.ArenaCapLength; for (int i = 0; i < this.Spawns.Count; i++) { ArenaSpawn spawn = this.Spawns[i]; if (spawn.AssignedTo == null) { spawn.AssignedTo = ship; ship.Spawn = spawn; if (ship.Pilot == ShipController.PilotType.Human) { Vector3 lookDir = Vector3.forward; ship.transform.position = spawn.HumanEnd.transform.position - initialSpawnSeperation * lookDir; ship.transform.rotation = Quaternion.LookRotation(lookDir); ship.MoveToFreeNav(spawn.AIEnd.transform.position); } else { Vector3 lookDir = -1 * Vector3.forward; ship.transform.position = spawn.AIEnd.transform.position - initialSpawnSeperation * lookDir; ship.transform.rotation = Quaternion.LookRotation(lookDir); ship.MoveToFreeNav(spawn.HumanEnd.transform.position); } return(true); } } return(false); }
public void AddSpawn(Vector3 humanPos, Vector3 aiPos) { int spawnIndex = this.Spawns.Count; ArenaSpawn spawn = new ArenaSpawn(); spawn.HumanEnd = this.AddNavPoint(humanPos, this.transform); spawn.HumanEnd.name = "HumanEnd" + spawnIndex; spawn.AIEnd = this.AddNavPoint(aiPos, this.transform); spawn.AIEnd.name = "AIEnd" + spawnIndex; this.Spawns.Add(spawn); }