示例#1
0
        /// <summary>
        /// Draw the inital map load decal
        /// </summary>
        public void InitialMapLoad()
        {
            if (GameMaster.IsThemePlaying == false)
            {
                GameMaster.PlayTheme();
            }
            var currentCenter = _worldView.Center;

            if (Math.Abs(WorldMap.EndOfMap.X - currentCenter.X) <= _worldView.Size.X / 2.0f)
            {
                IsInitialMapLoad = false;
                GameMaster.StopTheme();
                return;
            }
            if (WinInstance == null)
            {
                return;
            }
            InitLoadText.Position = new Vector2f(currentCenter.X, WinInstance.Size.Y / 2f);
            _worldView.Move(new Vector2f(150 * GameMaster.Delta.AsSeconds(), 0.0f));
            WinInstance.SetView(_worldView);
            WinInstance.Clear(WorldMap.BgColor);
            WinInstance.Draw(WorldMap);
            if (WorldMap.FloorObjects != null)
            {
                foreach (var floor in WorldMap.FloorObjects)
                {
                    WinInstance.Draw(floor);
                }
            }
            WinInstance.Draw(InitLoadText);
        }
示例#2
0
 /// <summary>
 /// Draw the health bar
 /// </summary>
 public override void Draw()
 {
     WinInstance.Draw(_mainRect);
     for (var i = 0; i < _numToDraw; i++)
     {
         WinInstance.Draw(_innerRects[i]);
     }
     WinInstance.Draw(_healthText);
 }
示例#3
0
 /// <summary>
 /// Draw the menu item to the screen
 /// </summary>
 public override void Draw()
 {
     if (ItemShape == null || ItemText == null)
     {
         return;
     }
     WinInstance.Draw(ItemShape);
     WinInstance.Draw(ItemText);
 }
示例#4
0
 /// <summary>
 /// Draw the splash screen
 /// </summary>
 public override void Draw()
 {
     if (_splashSound != null && _splashSound.Status != SoundStatus.Playing)
     {
         _splashSound.Play();
     }
     WinInstance.Clear(GameMaster.ThemeColor);
     foreach (var text in _splashText)
     {
         WinInstance.Draw(text);
     }
     WinInstance.Draw(_logo);
     WinInstance.Draw(_houseLogo);
 }
示例#5
0
        /// <summary>
        /// Draw the attack
        /// </summary>
        public override void Draw()
        {
            var tmp = Position;

            if (Direction == Moveable.Direction.Right)
            {
                tmp.X += IntialVelocity * GameMaster.Delta.AsSeconds();
            }
            else if (Direction == Moveable.Direction.Left)
            {
                tmp.X += -1 * IntialVelocity * GameMaster.Delta.AsSeconds();
            }
            _shot.Position = tmp;
            WinInstance.Draw(_shot);
            TotalTimeDrawn += GameMaster.Delta.AsSeconds();
        }
示例#6
0
 /// <summary>
 /// Display the number of lives to the screen
 /// </summary>
 private void DisplayLives()
 {
     if (_displayLives == false)
     {
         return;
     }
     if (LivesText == null)
     {
         var font = AssetManager.LoadFont("OrangeJuice");
         LivesText = new Text()
         {
             Color = Color.Black, Font = font, CharacterSize = 45, Position = new Vector2f(WorldPlayer.Position.X - 45, WorldPlayer.Position.Y - 80), DisplayedString = AssetManager.GetMessage("Lives") + NumberOfPlayerLives
         };
     }
     LivesText.Position        = new Vector2f(WorldPlayer.Position.X - 45, WorldPlayer.Position.Y - 80);
     LivesText.DisplayedString = AssetManager.GetMessage("Lives") + NumberOfPlayerLives;
     WinInstance.Draw(LivesText);
 }
示例#7
0
 /// <summary>
 /// Draw menu items and  pointer to the window
 /// </summary>
 public override void Draw()
 {
     if (_displayChars)
     {
         MenuItems = _charMenuItems;
     }
     else if (_originalMenuItems != null && _originalMenuItems.Count != 0)
     {
         MenuItems = _originalMenuItems;
     }
     WinInstance.Clear(GameMaster.ThemeColor);
     base.Draw();
     if (_displayChars && _characterStills != null)
     {
         foreach (var still in _characterStills)
         {
             WinInstance.Draw(still);
         }
     }
     Pointer.Draw();
 }
示例#8
0
 /// <summary>
 /// Draw the score display
 /// </summary>
 public override void Draw()
 {
     WinInstance.Draw(_scoreText);
 }
示例#9
0
 /// <summary>
 /// Draw the pointer to the window
 /// </summary>
 public override void Draw()
 {
     WinInstance.Draw(_pointerSprite);
 }
示例#10
0
 /// <summary>
 /// Draw all of the world entities to the window
 /// </summary>
 public override void Draw()
 {
     if (IsInitialMapLoad)
     {
         InitialMapLoad();
     }
     else if (_madeItToEnd && _loading == false)
     {
         WorldMap.BgMusic.Stop();
         PrepareNextMap();
     }
     else if (_madeItToEnd && _loading)
     {
         if (GameMaster.IsThemePlaying == false)
         {
             GameMaster.PlayTheme();
         }
         WinInstance.Clear(GameMaster.ThemeColor);
         WinInstance.Draw(LoadingText);
     }
     else if (_madeItToEnd == false && _loading == false && IsInitialMapLoad == false)
     {
         if (GameMaster.IsThemePlaying)
         {
             GameMaster.StopTheme();
         }
         if (WorldMap.BgMusic != null && WorldMap.BgMusic.Status != SoundStatus.Playing)
         {
             WorldMap.BgMusic.Play();
         }
         _worldView.Center = WorldPlayer.Position;
         WinInstance.SetView(_worldView);
         _healthBar.SetPosition(new Vector2f((_worldView.Center.X - _worldView.Size.X / 2.0f) + 30, _worldView.Center.Y - 350));
         _scoreDisp.SetPosition(new Vector2f((_worldView.Center.X + (_worldView.Size.X / 4.0f)), _worldView.Center.Y - 350));
         WinInstance.Clear(WorldMap.BgColor);
         WinInstance.Draw(WorldMap);
         if (WorldMap.FloorObjects != null)
         {
             foreach (var floor in WorldMap.FloorObjects)
             {
                 WinInstance.Draw(floor);
             }
         }
         if (EnemiesRendered != null && EnemiesRendered.Any())
         {
             var allEneMove = false;
             foreach (var enemy in EnemiesRendered)
             {
                 enemy.Play();
                 enemy.Update();
                 foreach (var shot in enemy.ShotsFired)
                 {
                     shot.Draw();
                 }
                 allEneMove = enemy.CanMove;
             }
             if (allEneMove)
             {
                 foreach (var enemy in EnemiesOnMap)
                 {
                     enemy.SetWaitToMax();
                 }
             }
         }
         else
         {
             if (EnemiesOnMap != null)
             {
                 var center  = _worldView.Center;
                 var size    = new Vector2f(_worldView.Size.X / 2, _worldView.Size.Y / 2);
                 var leftX   = center.X - size.X;
                 var rightX  = center.X + size.X;
                 var topY    = center.Y - size.Y;
                 var bottomY = center.Y + size.Y;
                 foreach (var enemy in EnemiesOnMap)
                 {
                     var enePos = enemy.Position;
                     if ((enePos.Y < topY) ||
                         (enePos.Y + enemy.Height > bottomY) ||
                         (enePos.X > rightX) ||
                         (enePos.X < leftX))
                     {
                         enemy.Stop();
                         continue;
                     }
                     enemy.Play();
                     foreach (var shot in enemy.ShotsFired)
                     {
                         shot.Draw();
                     }
                     enemy.Update();
                 }
             }
         }
         if (_displayLives && IsInitialMapLoad == false)
         {
             DisplayLives();
             _timeToDisp += GameMaster.Delta.AsSeconds();
             if (_timeToDisp >= _maxTimeToDisp)
             {
                 _displayLives       = false;
                 _dispControllerTime = false;
                 _timerStarted       = false;
                 _countDownTimer.Stop();
                 _timeToDisp = 0.0f;
             }
         }
         if (_dispControllerTime && IsInitialMapLoad == false)
         {
             InitDisplayCountDownTimer();
             if (_countDownText != null)
             {
                 WinInstance.Draw(_countDownText);
             }
         }
         foreach (var item in WorldMap.ItemsOnMap)
         {
             WinInstance.Draw(item.Item);
         }
         if (_localPause == false)
         {
             WorldPlayer.Update();
         }
         _healthBar.UpdateHealth(WorldPlayer.Health);
         _scoreDisp.UpdateScore(Score);
         _healthBar.Draw();
         _scoreDisp.Draw();
         foreach (var shot in WorldPlayer.ShotsFired)
         {
             shot.Draw();
         }
     }
     foreach (var npc in NpCsOnMap)
     {
         npc.Update();
     }
 }