Ejemplo n.º 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);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Draw menu items and  pointer to the window
 /// </summary>
 public override void Draw()
 {
     WinInstance.Clear(GameMaster.ThemeColor);
     WinInstance.SetView(WinInstance.DefaultView);
     base.Draw();
     Pointer.Draw();
 }
Ejemplo n.º 3
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);
 }
Ejemplo n.º 4
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();
 }
Ejemplo n.º 5
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();
     }
 }