示例#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();
        }