public void Update(double lastTick) { mailTimer.Update(lastTick); if (mailTimer.HasElapsed) { bool sendAvailableMail = false; foreach (MailItem mail in pendingMail) { if (!mail.IsReadyToDeliver()) { continue; } availableMail.Add(mail.Id, mail); sendAvailableMail = true; } // prevent sending multiple mail packets if (sendAvailableMail) { SendAvailableMail(); } // TODO: remove expired mail mailTimer.Reset(); } }
public Projectile(Point location, int direction, int range) : base(location, new Size(1, 1)) { ZIndex = 2; // draw projectiles on top of invaders State = MissileState.Lauched; Direction = direction; Range = range; UpdateTimer.Reset(50); SetBrick(Point.Empty, Brick.From('^', ConsoleColor.Red)); }
public WormsMenu(Point location) : base(location, new Size(25, 5)) { UpdateTimer.Reset(20); Items.AddRange(new MenuItem[] { new MenuItem("new_game_1", "1 Player"), new MenuItem("new_game_2", "2 Players"), new MenuItem("quit_game", "Quit"), }); Selected = Items[0]; }
public DefenderShip(Player player, Point location, Size range) : base(location, new Size(7, 2)) { InputProcess = InputProcessMode.KeyDown; Players.Add(player); Range = range; missiles = new List <Missile>(); Load(@"invaders\resources\defender1.txt", Point.Empty); UpdateTimer.Reset(50); fireTimer = new Timer(500); explodingTimer = new Timer(200); }
public void OnPositionUpdated(GameClient client, Position oldPosition, Position newPosition) { if (Timer == null) { Timer = new UpdateTimer(TimeSpan.FromMilliseconds(1)); Timer.Reset(); } client.FieldMap.SetPassable(oldPosition); client.FieldMap.SetWall(newPosition); UpdatePath(client); }
public InvaderShipUFO(Point location, Size range, bool moving = true) : base(location, new Size(16, 3), range) { UpdateTimer.Reset(75); Score = 100; timer.Reset(200); Show.Load(@"invaders\resources\alien_ufo.txt", Size, ConsoleColor.Yellow); this.moving = moving; speed = 0; movingTimer = new Timer(5000); Status = ShipStatus.Alerted; }
public InvadersMenu(Point location) : base(location, new Size(25, 5)) { Id = "MainMenu"; UpdateTimer.Reset(50); Items.AddRange(new MenuItem[] { new MenuItem("new_game_1", "1 Player"), new MenuItem("new_game_2", "2 Players"), new MenuItem("show_help", "Help"), new MenuItem("quit_game", "Quit"), }); Selected = Items[0]; }
public ScrollingText(string label, Point location, int width) : base(location, new Size(width, 1)) { Label = label; Foreground = ConsoleColor.White; Background = ConsoleColor.Black; Step = 1; UpdateTimer.Reset(100); queue = new Queue <char>(label.ToCharArray()); while (queue.Count < Size.Width) { queue.Enqueue(' '); } }
public void Show() { if (IsInitialized == false) { return; } if (IsVisible == true) { return; } IsVisible = true; // reset update timers so we will get first update just after show m_UpdateTimer.Reset(); m_LateUpdateTimer.Reset(); OnShow(); }
public override void OnEnqueueRemoveFromMap() { followTimer.Reset(false); OwnerGuid = 0u; }
public Bomb(Point location, int range) : base(location, +1, range) { UpdateTimer.Reset(100); SetBrick(Point.Empty, Brick.From(ColorConsole.CharMap['¥'], ConsoleColor.Red)); }