コード例 #1
0
        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();
            }
        }
コード例 #2
0
        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));
        }
コード例 #3
0
        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];
        }
コード例 #4
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);
 }
コード例 #5
0
ファイル: MapObject.cs プロジェクト: wren11/ETDA
        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);
        }
コード例 #6
0
        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;
        }
コード例 #7
0
        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];
        }
コード例 #8
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(' ');
            }
        }
コード例 #9
0
ファイル: GuiComponent.cs プロジェクト: huokele/shadow-gun
    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();
    }
コード例 #10
0
ファイル: VanityPet.cs プロジェクト: tydeFriz/NexusForever
 public override void OnEnqueueRemoveFromMap()
 {
     followTimer.Reset(false);
     OwnerGuid = 0u;
 }
コード例 #11
0
        public Bomb(Point location, int range) : base(location, +1, range)
        {
            UpdateTimer.Reset(100);

            SetBrick(Point.Empty, Brick.From(ColorConsole.CharMap['¥'], ConsoleColor.Red));
        }