/// <summary> /// Determine who won /// </summary> /// <param name="winner">The team that won</param> public void DetermineWinner(GameController.TeamColor winner) { if (winner == GameController.TeamColor.RED) { RedWin(); } else { BlueWin(); } }
/// <summary> /// Add to the amount of players on the point /// </summary> /// <param name="color">Team the player is on</param> public void AddPlayer(GameController.TeamColor color) { if (color == GameController.TeamColor.RED) { redNum++; } else { blueNum++; } }
/// <summary> /// Subtract from the amount of players on the point /// </summary> /// <param name="color">Team the player removed is on</param> public void RemovePlayer(GameController.TeamColor color) { if (color == GameController.TeamColor.RED) { redNum--; } else { blueNum--; } }
/// <summary> /// Set AI values /// </summary> /// <param name="color">Color of the AI's team</param> /// <param name="spawner">Spawner for theAI's team</param> /// <param name="enemyTeamMask">Layermask the enemy team is on</param> /// <param name="thisTeamMask">Layermask the AI's team is on</param> public void SetValues(GameController.TeamColor teamColor, SpawnManager spawner, LayerMask enemyTeam, LayerMask teamMask) { thisTeam = teamColor; this.spawner = spawner; this.enemyTeam = enemyTeam; gameObject.layer = teamMask; dead = true; speed = Random.Range(1, 3); health = Random.Range(3, 6); SetTarget(); Respawn(); StartCoroutine(Move()); }
/// <summary> /// Set player values /// </summary> /// <param name="color">Color of the player's team</param> /// <param name="spawner">Spawner for the player's team</param> /// <param name="enemyTeamMask">Layermask the enemy team is on</param> /// <param name="thisTeamMask">Layermask the player's team is on</param> public void SetValues(GameController.TeamColor color, SpawnManager spawner, LayerMask enemyTeamMask, LayerMask thisTeamMask) { thisTeam = color; enemyTeam = enemyTeamMask; this.spawner = spawner; gameObject.layer = thisTeamMask; // Change color of player if (color == GameController.TeamColor.RED) { sr.color = redColor; } else { sr.color = blueColor; } dead = true; Respawn(); StartCoroutine(Interact()); }
/// <summary> /// Create ai's for the team /// </summary> /// <param name="playerTeam">Team the player is on</param> public void CreateAIs(GameController.TeamColor playerTeam) { int redAdv = 0; int blueAdv = 0; if (playerTeam == GameController.TeamColor.RED) { redAdv++; } else { blueAdv++; } // Create red enemies for (int i = 0 + redAdv; i < 25; i++) { GameObject red = Instantiate(reds); AI redAI = red.GetComponent <AI>(); redAI.SetValues(GameController.TeamColor.RED, gc.red, blueMask, redMask); ai.Add(redAI); } // Create blue enemies for (int i = 0 + blueAdv; i < 25; i++) { GameObject blue = Instantiate(blues); AI blueAI = blue.GetComponent <AI>(); blueAI.SetValues(GameController.TeamColor.BLUE, gc.blue, redMask, blueMask); ai.Add(blueAI); } StartCoroutine(RespawnWaves()); }