Example #1
0
 public void UpdateMissionRuntime(TimeSpan elapsed)
 {
     msnRuntime?.Update(elapsed);
     if (World != null)
     {
         while (worldActions.Count > 0)
         {
             worldActions.Dequeue()();
         }
     }
 }
Example #2
0
        void InitStory(Data.Save.SaveGame sg)
        {
            var missionNum = sg.StoryInfo?.MissionNum ?? 0;

            if (game.GameData.Ini.ContentDll.AlwaysMission13)
            {
                missionNum = 14;
            }
            if (missionNum != 0 && (missionNum - 1) < game.GameData.Ini.Missions.Count)
            {
                msnRuntime = new MissionRuntime(game.GameData.Ini.Missions[missionNum - 1], this);
                msnRuntime.Update(TimeSpan.Zero);
            }
        }
Example #3
0
 public bool Update(SpaceGameplay gameplay, TimeSpan elapsed)
 {
     forcedLand = null;
     if (msnrun != null)
     {
         msnrun.Update(gameplay, elapsed);
     }
     if (forcedLand != null)
     {
         Game.ChangeState(new RoomGameplay(Game, this, forcedLand));
         return(true);
     }
     return(false);
 }
Example #4
0
        void InitStory(Data.Save.SaveGame sg)
        {
            var missionNum = sg.StoryInfo?.MissionNum ?? 0;

            MissionNumber(sg.StoryInfo?.Mission, ref missionNum);
            if (Game.GameData.Ini.ContentDll.AlwaysMission13)
            {
                missionNum = 14;
            }
            if (missionNum != 0 && (missionNum - 1) < Game.GameData.Ini.Missions.Count)
            {
                msnRuntime = new MissionRuntime(Game.GameData.Ini.Missions[missionNum - 1], this);
                msnRuntime.Update(0.0);
            }
        }
Example #5
0
        public bool Update(SpaceGameplay gameplay, TimeSpan elapsed)
        {
            forcedLand = null;
            if (msnrun != null)
            {
                msnrun.Update(gameplay, elapsed);
            }
            if (forcedLand != null)
            {
                Game.ChangeState(new RoomGameplay(Game, this, forcedLand));
                return(true);
            }
            if (Client != null)
            {
                var gt = gp.player.GetTransform();
                Client.SendPositionUpdate(gt.Transform(Vector3.Zero),
                                          gt.ExtractRotation());
            }

            return(false);
        }
Example #6
0
        public void OpenSaveGame(Data.Save.SaveGame sg)
        {
            Orientation       = Quaternion.Identity;
            Position          = sg.Player.Position;
            Base              = sg.Player.Base;
            System            = sg.Player.System;
            Character         = new NetCharacter();
            Character.Credits = sg.Player.Money;
            string ps;

            if (sg.Player.ShipArchetype != null)
            {
                ps = sg.Player.ShipArchetype;
            }
            else
            {
                ps = game.GameData.GetShip(sg.Player.ShipArchetypeCrc).Nickname;
            }
            Character.Ship      = game.GameData.GetShip(ps);
            Character.Equipment = new List <NetEquipment>();
            foreach (var eq in sg.Player.Equip)
            {
                var       hp = eq.Hardpoint;
                Equipment equip;
                if (eq.EquipName != null)
                {
                    equip = game.GameData.GetEquipment(eq.EquipName);
                }
                else
                {
                    equip = game.GameData.GetEquipment(eq.EquipHash);
                }
                if (equip != null)
                {
                    Character.Equipment.Add(new NetEquipment()
                    {
                        Equipment = equip, Hardpoint = hp, Health = 1
                    });
                }
            }
            if (Base != null)
            {
                lock (rtcs)
                {
                    client.SendPacket(new BaseEnterPacket()
                    {
                        Base = Base,
                        Ship = Character.EncodeLoadout(),
                        RTCs = rtcs.ToArray()
                    }, NetDeliveryMethod.ReliableOrdered);
                }
            }
            else
            {
                var sys = game.GameData.GetSystem(System);
                game.RequestWorld(sys, (world) =>
                {
                    World = world;
                    client.SendPacket(new SpawnPlayerPacket()
                    {
                        System      = System,
                        Position    = Position,
                        Orientation = Orientation,
                        Ship        = Character.EncodeLoadout()
                    }, NetDeliveryMethod.ReliableOrdered);
                    world.SpawnPlayer(this, Position, Orientation);
                });
            }
            var missionNum = sg.StoryInfo?.MissionNum ?? 0;

            if (game.GameData.Ini.ContentDll.AlwaysMission13)
            {
                missionNum = 14;
            }
            if (missionNum != 0 && (missionNum - 1) < game.GameData.Ini.Missions.Count)
            {
                msnRuntime = new MissionRuntime(game.GameData.Ini.Missions[missionNum - 1], this);
                msnRuntime.Update(TimeSpan.Zero);
            }
        }
Example #7
0
 public void UpdateMissionRuntime(TimeSpan elapsed)
 {
     msnRuntime?.Update(elapsed);
 }