public Team(TeamName teamName, TeamSection section) { name = teamName; teamSection = section; section.team = this; }
/// <summary> /// Creates the default match information. /// </summary> /// <returns>The default match reference.</returns> public static Match CreateDefaultMatch() { // Create a new match. Match newMatch = new Match(); // Total size of no man's land. float NoMansLandSize = Constants.MAP_WIDTH * Constants.NO_MANS_LAND_PERCENT; // Number of tiles that will make up no man's land. int NoMansLandTiles = (int)(NoMansLandSize / Constants.TILE_SIZE); // Number of tiles on each side of the center tile, for no man's land. int NoMansLandTilesOnEachSide = NoMansLandTiles / 2 - 1; newMatch.teams = new List <Team>(); // Set up no man's land information. newMatch.NoMansLand = new TeamSection { // Left bound is slightly offset from the map center, to the left. leftX = (0.0f - (Constants.TILE_SIZE / 2.0f)) - (NoMansLandTilesOnEachSide * Constants.TILE_SIZE), // Right bound is slightly offset from the map center, to the right. rightX = (0.0f + (Constants.TILE_SIZE / 2.0f)) + (NoMansLandTilesOnEachSide * Constants.TILE_SIZE), // Upper bound is at the top of the map. upZ = (Constants.MAP_HEIGHT / 2.0f) - Constants.TREE_RADIUS, // Lower bound is at the bottom of the map. downZ = -(Constants.MAP_HEIGHT / 2.0f), // Color should be gray (or normal? idk). sectionColor = new Vector3(0.7f, 0.7f, 0.7f) }; newMatch.NoMansLand.team = new Team(TeamName.NONE, newMatch.NoMansLand); // Create a new section for team one, on the left side of the map. TeamSection redSection = new TeamSection { leftX = -(Constants.MAP_WIDTH / 2.0f), rightX = newMatch.NoMansLand.leftX, upZ = (Constants.MAP_HEIGHT / 2.0f) - Constants.TREE_RADIUS, downZ = -(Constants.MAP_HEIGHT / 2.0f), // Make the section red sectionColor = new Vector3(1.8f, 1.0f, 1.0f) }; redSection.InitSpawnPoints(); newMatch.teams.Add(new Team(TeamName.RED, redSection)); // Create a new section for team two, on the right side of the map. TeamSection blueSection = new TeamSection { leftX = newMatch.NoMansLand.rightX, rightX = Constants.MAP_WIDTH / 2.0f, upZ = Constants.MAP_HEIGHT / 2.0f - Constants.TREE_RADIUS, downZ = -Constants.MAP_HEIGHT / 2.0f, // Make the section blue. sectionColor = new Vector3(1.0f, 1.0f, 1.8f) }; blueSection.InitSpawnPoints(); newMatch.teams.Add(new Team(TeamName.BLUE, blueSection)); // Print out the bounds of the match. Console.WriteLine(newMatch.teams[0].teamSection); Console.WriteLine(newMatch.teams[1].teamSection); Console.WriteLine(newMatch.NoMansLand); newMatch.matchType = MatchType.TEAMS_1; // Set the default match and return it. _DefaultMatch = newMatch; return(newMatch); }