示例#1
0
        /// <summary>
        /// Changed the current player on screen to the next one in the list
        /// </summary>
        private void ChangePlayer()
        {
            if (_currentPlayerIndex >= 3)
            {
                _currentPlayerIndex = 0;
            }
            else
            {
                _currentPlayerIndex++;
            }
            var currentPos = WorldPlayer.Position;
            var health     = WorldPlayer.Health;
            var currDir    = WorldPlayer.CurrentDirection;
            var isFalling  = WorldPlayer.IsFalling;

            WorldPlayer.RemoveControls();
            WorldPlayer.ChangePlayer = false;
            WorldPlayer.ShotsFired   = new List <Shot>();
            WorldPlayer           = _players[_currentPlayerIndex];
            WorldPlayer.IsFalling = isFalling;
            WorldPlayer.Health    = health;
            WorldPlayer.SetPosition(currentPos);
            WorldPlayer.SetDirection(currDir);
            WorldPlayer.AddControls();
            WorldPlayer.SetWaitToMax();
        }
示例#2
0
 /// <summary>
 /// Pause worldly actions
 /// </summary>
 public void Pause()
 {
     _localPause = true;
     foreach (var enemy in EnemiesOnMap)
     {
         enemy.Stop();
         enemy.ResetWaitTime();
         enemy.ShotsFired = new List <Shot>();
     }
     WorldPlayer.RemoveControls();
     WorldPlayer.ResetWaitTime();
 }
示例#3
0
        /// <summary>
        /// Prepare the next mapl for loading to the world
        /// </summary>
        private void PrepareNextMap()
        {
            CurrentMap++;
            WorldPlayer.RemoveControls();
            _loading = true;
            if (LoadingText == null)
            {
                var font = AssetManager.LoadFont("OrangeJuice");
                LoadingText = new Text()
                {
                    Position = WinInstance.DefaultView.Center, DisplayedString = AssetManager.GetMessage("Loading"), CharacterSize = 60, Color = Color.Black, Font = font
                };
            }
            WinInstance.SetView(WinInstance.DefaultView);
            var ts = new ThreadStart(LoadNewMap);

            _loadingThread = new Thread(ts)
            {
                Priority = ThreadPriority.Highest, IsBackground = true
            };
            _loadingThread.Start();
        }