public Base(GameWorld world, Vector2 position, Vector2 velocity, float diameter, Vector2 size, Vector2 world2model, int imgIndex, team_t color, Color teamColor, int maxlife = 20) : base(world, new Vector2(position.x - (position.x % 32), position.y - (position.y % 32)), velocity, diameter, size, world2model, imgIndex, maxlife) { team = color; myBehavior = new BaseBehavior(world, this, team, teamColor); if (team == team_t.Red) { this.actorName = "Red Base"; this.anim = new Animation(world.engine.resourceComponent, "Sprites/003_redBase/"); } else if (team == team_t.Blue) { this.anim = new Animation(world.engine.resourceComponent, "Sprites/004_blueBase/"); this.actorName = "Blue Base"; } else if (team == team_t.Yellow) { this.anim = new Animation(world.engine.resourceComponent, "Sprites/005_yellowBase/"); this.actorName = "Yellow Base"; } else if (team == team_t.Purple) { this.anim = new Animation(world.engine.resourceComponent, "Sprites/006_purpleBase/"); this.actorName = "Purple Base"; } position = new Vector2(position.x - (position.x % 32), position.y - (position.y % 32)); }
public OrderContext(GameWorld world, team_t color) { this.world = world; this.team = color; this.units = new List <AnimalActor>(); }
public Platoon(GameWorld world, team_t color) { this.world = world; this.team = color; this.units = new List <AnimalActor>(); }
public BaseBehavior(GameWorld world, GameActor actor, team_t team, Color teamColor) : base(world, actor) { this.actor = actor; this.team = team; this.teamColor = teamColor; }
public TeamState(Game engine, GUILabel guiLabel, team_t color, string bannerPath, player_type_t type = player_type_t.None) { gameEngine = engine; GuiLabel = guiLabel; GuiLabel.mouseClickEvent += updateType; TeamVal = new Team(color, type, bannerPath); }
/** * Load a saved camera position. Each team gets one slot. * * @param team Current player's team * * @return True if the camera moved, false otherwise */ public bool loadView(team_t team, bool draw = false) { if (TeamDictionary.TeamDict[team].CameraPosition == null) { return(false); } return(moveCamera(TeamDictionary.TeamDict[team].CameraPosition, draw)); }
public HumanPlayer(GameWorld world, team_t team) : base(world, team) { click = world.click; enter = world.enter; rightClick = world.rightClick; movedUnits = new LinkedList <AnimalActor>(); }
public Team(team_t teamColor, player_type_t playerType, string bannerPath) { IsActive = false; Color = teamColor; PlayerType = playerType; BannerPath = bannerPath; ActorList = new LinkedList <AnimalActor>(); CameraPosition = new Vector2(0, 0); }
public void unreadyTeam(team_t team) { unitsMoved = 0; foreach (var actor in TeamDictionary.TeamDict[team].ActorList) { actor.canMove = false; actor.canAct = false; actor.changeActorSprite(false); } }
public void readyTeam(team_t team) { teamBox.texture = new Handle(engine.resourceComponent, TeamDictionary.TeamDict[team].BannerPath); teamBox.pos = new Vector2(engine.graphicsComponent.width / 2 - teamBox.size.x / 2, 0); teamBoxCooldown = 120; unitsMoved = 0; currentActors = new List <AnimalActor>(); foreach (var actor in TeamDictionary.TeamDict[team].ActorList) { currentActors.Add(actor); actor.canMove = true; actor.canAct = true; } }
void BroadcastTeamChange(gclient_t client, team_t oldTeam) { switch (client.sess.sessionTeam) { case team_t.TEAM_FREE: Server.Instance.SendServerCommand(null, string.Format("print \"{0}^7 joined the battle.\n\"", client.pers.netname)); break; case team_t.TEAM_SPECTATOR: Server.Instance.SendServerCommand(null, string.Format("print \"{0}^7 joined the spectators.\n\"", client.pers.netname)); break; case team_t.TEAM_RED: Server.Instance.SendServerCommand(null, string.Format("print \"{0}^7 joined the ^1red^7 team.\n\"", client.pers.netname)); break; case team_t.TEAM_BLUE: Server.Instance.SendServerCommand(null, string.Format("print \"{0}^7 joined the ^2blue^7 team.\n\"", client.pers.netname)); break; } }
public ComputerPlayer(GameWorld world, team_t team) : base(world, team) { // For right now, we'll group all our units into one platoon // Typically, you would create new, smaller, mutually exclusive lists, // and feed one to each platoon Platoon dfltPlat = new Platoon(this.world, this.team); //Order dfltOrder = new HoldPositionOrder(dfltPlat, null, 5); //Order dfltOrder = new SurroundOrder(dfltPlat); Order dfltOrder = new SurroundOrder2(dfltPlat); //Order dfltOrder = new AttackOrder(dfltPlat, null); dfltPlat.setOrder(dfltOrder); platoons = new LinkedList <Platoon>(); platoons.AddLast(dfltPlat); turnThread = null; saveUnitList(); }
// Switch focus to the next team in the array public void endTurn() { // increment current team and ready it while unreadying the old team unreadyTeam(currentColor); // set currentTeam to the next team in the list (accounting for wraparound with a mod currentTeam = (currentTeam + 1) % (numTeams); currentColor = playerList[currentTeam].team; //if (currentTeam != 0) //{ // teamBox.texture = new Handle(engine.resourceComponent, TeamDictionary.TeamDict[currentColor].BannerPath); // teamBoxCooldown = 120; //} //teamBox.pos = new Vector2(engine.graphicsComponent.width / 2 - teamBox.size.x / 2, 0); readyTeam(currentColor); playerList[currentTeam].startTurn(); }
private void checkEndOfGame() { int teamCount = 0; team_t teamColor = team_t.Purple; foreach (LinkedList <AnimalActor> team in world.teams) { if (team.Count() > 0) { teamCount++; teamColor = team.First().team; } } if (teamCount <= 1) { var gameOverScreen = new GameOverScreen(world.engine); gameOverScreen.ShowWinner(teamColor); //world.engine.quit = true; } }
protected override void start() { Handle song = engine.resourceComponent.get("Music/Menu.ogg"); //engine.audioComponent.playSong(true, song); if (!engine.currentWorldName.Equals("Maps/Menu.map")) { initializeInfoBox(); engine.inputComponent.normalize(); foreach (var teamEntry in TeamDictionary.TeamDict.Values) { if (teamEntry.PlayerType == player_type_t.Human) { TeamDictionary.TeamDict[teamEntry.Color].IsActive = true; playerList.Add(new HumanPlayer(this, teamEntry.Color)); teams.Add(TeamDictionary.TeamDict[teamEntry.Color].ActorList); numTeams++; } else if (teamEntry.PlayerType == player_type_t.Computer) { TeamDictionary.TeamDict[teamEntry.Color].IsActive = true; playerList.Add(new ComputerPlayer(this, teamEntry.Color)); teams.Add(TeamDictionary.TeamDict[teamEntry.Color].ActorList); numTeams++; } } cameraManager = new CameraManager(engine, numTeams); currentColor = playerList.First().team; readyTeam(currentColor); endTurn(); } }
public override void changeTeam(team_t newTeam) { team = newTeam; changeActorSprite(false); base.changeTeam(newTeam); }
public void ShowWinner(team_t teamColor) { HandleDict[teamColor].pos = new Vector2(0, 0); engine.graphicsComponent.gui.add(HandleDict[teamColor]); }
/** * Save the current camera position. Each team gets one slot. * * @param team Current player's team * * @return same as getPosition() */ public Vector2 saveView(team_t team) { TeamDictionary.TeamDict[team].CameraPosition = new Vector2(cam.position); return(cam.position); }
/*************************************** Team Functions ***************************************/ public void addToTeam(AnimalActor recruit, team_t newTeam) { TeamDictionary.TeamDict[newTeam].ActorList.AddLast(recruit); }
int TeamCount(int ignoreClientNum, team_t team) { int count = 0; for (int i = 0; i < level.maxclients; i++) { if (i == ignoreClientNum) continue; if (level.clients[i].pers.connected == clientConnected_t.CON_DISCONNECTED) continue; if (level.clients[i].sess.sessionTeam == team) count++; } return count; }
public Player(GameWorld world, team_t team) { this.world = world; this.team = team; this.units = TeamDictionary.TeamDict[team].ActorList; }
/** * Changes the Animal Actors team, overloaded later. * */ public virtual void changeTeam(team_t newTeam) { team = newTeam; world.addToTeam(this, team); }