public override void Render(GBitmap screen) { screen.Fill(175, 0, 0, 0); Modes mode = GameLevel.GetMode(); int colWidth = 195; int nameColSx = screen.ScreenWidth / 2 - colWidth / 2; int killsColSx = nameColSx + 100; int deathsColSx = killsColSx + 50; int yo = 20; GFont.WriteXCenter(screen, "statistics", 2, yo); yo += 40; if (mode == Modes.Deathmatch) { RenderColTitle(screen, ref yo, nameColSx, killsColSx, deathsColSx); foreach (Player player in Players) { RenderPlayer(screen, ref yo, player.Name, player.Kills, player.Deaths, nameColSx, killsColSx, deathsColSx); } } else { int xo = -(screen.ScreenWidth - colWidth) / 4 - 15; int col2Yo = yo; GFont.Write(screen, "team of blu", 1, nameColSx + xo, yo); yo += 20; RenderColTitle(screen, ref yo, nameColSx + xo, killsColSx + xo, deathsColSx + xo); foreach (Player player in Players) { if (player.Team == Teams.Blu) { RenderPlayer(screen, ref yo, player.Name, player.Kills, player.Deaths, nameColSx + xo, killsColSx + xo, deathsColSx + xo); } } xo = -1 * xo; yo = col2Yo; GFont.Write(screen, "team of red", 1, nameColSx + xo, yo); yo += 20; RenderColTitle(screen, ref yo, nameColSx + xo, killsColSx + xo, deathsColSx + xo); foreach (Player player in Players) { if (player.Team == Teams.Red) { RenderPlayer(screen, ref yo, player.Name, player.Kills, player.Deaths, nameColSx + xo, killsColSx + xo, deathsColSx + xo); } } } }
private void InitGame() { if (GameLevel.GetMode() == Modes.Deathmatch) { TeamNotSelected = false; } this.PausePopUp = new Pause(Input); StartPlaying(); }
public void Respawn() { Teams team = Team; if (GameLevel.GetMode() == Modes.Deathmatch) { team = Teams.NoTeam; } SetCoordinates(GetSpawnCoordinates(GameLevel.GetSpawners(team))); Reanimate(); UnbindMasterEntityMoving(); GameLevel.CenterCameraOnPlayer(); }
public override void Update() { base.Update(); if (!AskIsOn) { Menu.Update(); } if (Menu.Is(0)) { GameGuiScreen.Paused = false; GameGuiScreen.Self.StartPlaying(); } int disconnectIndex = 2; int quitIndex = 3; if (GameLevel.GetMode() == Modes.Deathmatch) { --disconnectIndex; --quitIndex; } else if (Menu.Is(1)) { // Change team stuff... } if (Menu.Is(disconnectIndex)) { DisconnectGame(); GameComponent.SetCurrentScreen(0); } if (!PassTick && Menu.Is(quitIndex)) { DisconnectGame(); AskToQuit(delegate() { Pause pause = ((GameGuiScreen)GameComponent.GetScreen(4)).PausePopUp; pause.AskIsOn = false; pause.PassTick = true; }); } }
public Pause(InputHandler Input) : base(Input, true, false, true, true) { SetTitle("paused"); List <string> items = new List <string>(); items.Add("continue"); if (GameLevel.GetMode() != Modes.Deathmatch) { items.Add("change team"); } items.Add("disconnect"); items.Add("quit game"); this.Menu = new MenuList(Input, items.ToArray()); Menu.SetStartY(60); Menu.SetFontSize(1); AskPopUp.SetBgTransparency(175); }
public void InitLevelList() { Controls.Clear(); Selector = new SelectableGrid(Input, 100, 60, 4); Selector.SetX(100); Selector.SetY(60); Selector.SetBorder(3); Selector.SetItemDimension(100, 100); LevelManager manager = new LevelManager(); for (int i = 0; i < manager.GetLevelsAmount(GameLevel.GetMode()); ++i) { string name = manager.GetLevelName(GameLevel.GetMode(), i); GBitmap thumbnail = LevelGen.CreateThumbnail(manager.GetLevelStream(GameLevel.GetMode(), i)); Selector.Push(new GridItem(manager.ParseName(GameLevel.GetMode(), name), thumbnail)); } Controls.Add(Selector); }
public override void Update() { if (Direction == Directions.Left) { MoveLeft(Speed); } if (Direction == Directions.Right) { MoveRight(Speed); } if (Direction == Directions.Up) { MoveUp(Speed); } if (Direction == Directions.Down) { MoveDown(Speed); } List <GEntity> IntersectingEntities = GameLevel.GetIntersectingEntities(this); foreach (GEntity Entity in IntersectingEntities) { if (!Entity.CanBulletPass) { Entity.Damage(BDamage); if (Entity.IsMetallic || Entity.IsBrick) { Remove(Entity); } else { Remove(); } } } List <Player> IntersectingEnemies = GameLevel.GetIntersectingPlayers(this, IntersectionType.BY_DIFF_OWNER); foreach (Player Enemy in IntersectingEnemies) { if ((GameLevel.GetMode() == Modes.TeamDeathmatch || GameLevel.GetMode() == Modes.CaptureFlag) && Player.GetTeamById(Enemy.Id) != Player.GetTeamById(Owner)) { Enemy.Damage(BDamage); if (Player.IsMe(Owner)) { ++GameComponent.Gs.IntStatsHits; if (Enemy.Removed) { Player.IncrementKills(Owner); } } } Remove(Enemy); } List <Bullet> IntersectingBullets = GameLevel.GetIntersectingBullets(this); foreach (Bullet B in IntersectingBullets) { B.Remove(); this.Remove(); } // Dispose the memory if (X <= 0 || Y <= 0 || X >= GameLevel.MAX_LEVEL_WIDTH || Y >= GameLevel.MAX_LEVEL_HEIGHT) { Remove(); } }
public override void Render(GBitmap screen) { base.Render(screen); GFont.Write(screen, "mode " + (int)GameLevel.GetMode(), 1, 10, 10); GFont.Write(screen, "levels " + Selector.Grid.Count, 1, 10, 20); }