Exemplo n.º 1
0
        private void Flashing(Timer timer)
        {
            /*
            _flashSprite[0].X = X;
            _flashSprite[0].Y = Y;
            _flashSprite[0].Angle = (ushort)Angle;

            float amount = (float)Math.Pow(timer.Progress, 2);
               			_flashSprite[0].Color = new Color4(amount,amount,amount,0.0f);
            _game.Application.Renderer.AddDrawable(_flashSprite);*/
        }
Exemplo n.º 2
0
        public HudBuildablePullout(Game game, Renderer r, int basePriority)
        {
            _game = game;
            _basePriority = basePriority;

            _stayUpTimer = new Timer(TimerMode.CountDown, 60*3);
            _stayUpTimer.Elapsed += HandleStayUpTimerElapsed;
            _foldingTimer = new Timer(TimerMode.CountDown, 100);
            _foldingTimer.Ticked += HandleFoldingTimerTicked;

            _panel = new Panel(_basePriority-1);
            _panel.Width = 96;
            _panel.Corners = Corners.Top|Corners.BottomRight;
            _panel.Color = Color;

            _iconPanel = new Panel(_basePriority-1);
            _iconPanel.Y = r.Height-HudToolbar.Height;
            _iconPanel.Width = 56;
            _iconPanel.Height = HudToolbar.Height;
            _iconPanel.Corners = Corners.Bottom;
            _iconPanel.Color = Color;

            //_captionIcon = new Sprite(_captionIcons, Drawable.Flags.NoScroll, _basePriority+2);

            _icons = new Sprite(_game.Config.GetWidgetTemplate("bpinfoicons"), Drawable.Flags.NoScroll, _basePriority+2);
            _icons.Resize(4);
            _icons[0].Frame = 3;
            _icons[1].Frame = 0;
            _icons[2].Frame = 2;
            _icons[3].Frame = 1;

            _text[0] = new TextLine(r,0,0,_basePriority+2);
            _text[1] = new TextLine(r,0,0,_basePriority+2);
            _text[2] = new TextLine(r,0,0,_basePriority+2);
            _text[3] = new TextLine(r,0,0,_basePriority+2);
            _text[4] = new TextLine(r,0,0,_basePriority+2);
        }
Exemplo n.º 3
0
 private void HandleStayUpTimerElapsed(Timer timer)
 {
     _foldingTimer.ResetValue = _panel.Height;
     _foldingTimer.Mode = TimerMode.CountUp;
     _foldingTimer.Reset();
 }
Exemplo n.º 4
0
 private void HandleFoldingTimerTicked(Timer timer)
 {
 }
Exemplo n.º 5
0
        private void HandleFireOrTargetingTimerElapsed(Timer timer)
        {
            if(_fireTimer.IsElapsed && IsTargetInSight)
            {
                _fireTimer.Reset();

                // Fire!
                float d = Util.Distance(X,Y,Target.X,Target.Y);
                float dirX;
                float dirY;
                Angles.AngleToDirection(Angle,out dirX, out dirY);
                float gunX = X + dirX * (32-8);
                float gunY = Y + dirY * (32-8);

                _game.AddObject(new Bullet(_game, gunX, gunY, X + d * dirX, Y + d * dirY, CurrentUpgrade.Damage));

                _fired = true;
            //			_flashTimer.Reset();
            }
            else
            {
                // Try again in a few ticks.
                _targetingTimer.Reset();
            }
        }