예제 #1
0
        public override void PlayerQuitEvent(PlayerProfile p)
        {
            int        FactionNumber = -1;
            PlayerShip playerShip    = null;

            foreach (PlayerShip s in Enumerate(typeof(PlayerShip)))
            {
                if (s.MyProfile == p)
                {
                    playerShip    = s;
                    FactionNumber = s.FactionNumber;
                }
            }

            if (playerShip != null)
            {
                playerShip.Destroy();

                LinkedList <BasicShipGameObject> toDestroy = new LinkedList <BasicShipGameObject>();

                foreach (BasicShipGameObject o in Enumerate(typeof(BasicShipGameObject)))
                {
                    if (o.FactionNumber == FactionNumber)
                    {
                        toDestroy.AddLast(o);
                    }
                }

                foreach (BasicShipGameObject o in toDestroy)
                {
                    o.Destroy();
                }

                ChooseStartState.RemovePlayer();
                FactionManager.Remove(FactionNumber);
            }

            base.PlayerQuitEvent(p);
        }