void DelayedAddShip(object oship)
        {
            IShip oldShip = (IShip)oship;

            Thread.Sleep(VictorySongWait);
            ShipSounds Victor = null;

            if (Array.IndexOf <string>(SuicideShipNames, oldShip.GetType().Name) != -1)
            {
                Victor = oldShip.ShipSounds;
            }
            foreach (IShip ship in GetShips())
            {
                if (!ship.IsExpired)
                {
                    if ((ship.FactionInfo.FactionCollection.GetDiplomacy(ship.FactionInfo, oldShip.FactionInfo) & FactionDiplomacy.Enemy) == FactionDiplomacy.Enemy)
                    {
                        Victor = ship.ShipSounds;
                        break;
                    }
                }
            }
            if (Victor != null)
            {
                Victor.Victory.Play();
            }
            Thread.Sleep(DeathWait - VictorySongWait);
            lock (world)
            {
                ReMasterSDL.physicsTimer.Enabled = false;

                lock (syncroot)
                {
                    GameResult gameResult = new GameResult();
                    IShip      newShip    = GetNewShip(oldShip.FactionInfo);
                    //IShip newShip2 = (IShip)newShip.Clone();
                    newShip.AddControler(null, oldShip.Controlers[0]);
                    if (oldShip.Controlers.Length > 1)
                    {
                        newShip.AddControler(null, oldShip.Controlers[1]);
                    }
                    AddShip(gameResult, newShip, oldShip.FactionInfo);
                    world.HandleActionEvents(gameResult);
                }
            }
            BindWorld(CamerasLastPosition);

            MeleeMusic.PlayDefault();
            Thread.Sleep(AfterChoiceWait);
            ReMasterSDL.physicsTimer.Enabled = true;
        }
        public void OnBulletCollision(object sender, ShipCollisionEventArgs args)
        {
            IShip ship = args.Ship;

            if (ship.GetType().BaseType == typeof(EnemyShip))
            {
                if (!ship.IsAlive())
                {
                    DestroyShip(ship);

                    OnSendMessageWhenShipDestroyed(new NewDestroyShipEventArgs(100));
                }
                else
                {
                    DecreaseArmor(ship);
                }
            }
        }
Ejemplo n.º 3
0
 public void Sail()
 {
     Console.WriteLine("Sailing {0} - {1} mile, turbo ON= {2} ", _ship.GetType().Name, _ship.Sail(), _turbo.ToString());
 }