OrientedActor CreatePlayer(bool iscyan, bool isdefender) { OrientedActor newPlayer = Instantiate <OrientedActor> (actorPrefab); newPlayer.CtF = this; if (iscyan) { cyanCount++; newPlayer.teamNum = cyanCount; newPlayer.teamName = "Cyan Player "; newPlayer.position = CyanZone [Random.Range(0, CyanZone.Count - 1)].transform.position; newPlayer.currentNode = grid.PostoNode(newPlayer.position); newPlayer._Team = OrientedActor.Team.cyan; if (isdefender) { newPlayer.SetJob(1); newPlayer.gameObject.name = "Cyan Defender"; } else { newPlayer.gameObject.name = "Cyan Attacker"; newPlayer.SetJob(2); } } else { mangCount++; newPlayer.teamNum = mangCount; newPlayer.teamName = "Mangetta Player "; newPlayer.position = MangettaZone [Random.Range(0, CyanZone.Count - 1)].transform.position; newPlayer.currentNode = grid.PostoNode(newPlayer.position); newPlayer._Team = OrientedActor.Team.mangetta; if (isdefender) { newPlayer.gameObject.name = "Mangetta Defender"; newPlayer.SetJob(1); } else { newPlayer.gameObject.name = "Mangetta Attacker"; newPlayer.SetJob(2); } } newPlayer.transform.SetParent(transform); newPlayer.gameObject.SetActive(true); playerCount++; return(newPlayer); }
private void PathFollow(List <GridNode> path) { SeekToGrid(tarNode); if (self.currentNode == tarNode) { ResetPathColor(); FindPath(); } if (self.currentNode == goalNode) { if (self._Team == OrientedActor.Team.cyan) { self.PrintMessage("Status: Teammate Rescued!"); } self.SetJob(1); teamMate.captured = false; teamMate.SetJob(2); } }