예제 #1
0
        public override void Load()
        {
            base.Load();

            MyScriptWrapper.AlarmLaunched += MyScriptWrapper_AlarmLaunched;

            // Turn off sunwind, meteorwind and icestorm
            MyScriptWrapper.EnableGlobalEvent(World.Global.MyGlobalEventEnum.SunWind, false);
            MyScriptWrapper.EnableGlobalEvent(World.Global.MyGlobalEventEnum.MeteorWind, false);
            MyScriptWrapper.EnableGlobalEvent(World.Global.MyGlobalEventEnum.IceStorm, false);

            // Add Fourth Reich FalseId to inventory if player already haven't got one
            MyScriptWrapper.AddFalseIdToPlayersInventory(MyMwcObjectBuilder_FactionEnum.FourthReich);

            // Add Radar Jammer to player inventory
            MyScriptWrapper.AddInventoryItem(MyScriptWrapper.GetPlayerInventory(), MyMwcObjectBuilderTypeEnum.SmallShip_Tool, (int)MyMwcObjectBuilder_SmallShip_Tool_TypesEnum.RADAR_JAMMER, 1f);

            // Add Hacking Tool to player inventory
            MyScriptWrapper.AddInventoryItem(MyScriptWrapper.GetCentralInventory(), MyMwcObjectBuilderTypeEnum.SmallShip_HackingTool, (int)MyMwcObjectBuilder_SmallShip_HackingTool_TypesEnum.Level_2, 1f, true);
            MyScriptWrapper.AddInventoryItem(MyScriptWrapper.GetCentralInventory(), MyMwcObjectBuilderTypeEnum.SmallShip_HackingTool, (int)MyMwcObjectBuilder_SmallShip_HackingTool_TypesEnum.Level_3, 1f, true);

            // Set musicmood right from script start
            MyAudio.ApplyTransition(MyMusicTransitionEnum.TensionBeforeAnAction);

            m_Slave = (MySmallShipBot)MyScriptWrapper.TryGetEntity(328);
            MySession.PlayerFriends.Add(m_Slave);
            m_Slave.Follow(MySession.PlayerShip);
            m_Slave.SetName("Slave");
        }
        public MyGuiScreenEditorSmallShip(MySmallShip smallShip)
            : base(smallShip, new Vector2(0.5f, 0.5f), MyGuiConstants.SCREEN_BACKGROUND_COLOR, null, MyTextsWrapperEnum.EditSmallShip)
        {
            m_bot = smallShip as MySmallShipBot;

            Init();

            m_selectShipFactionCombobox.SelectItemByKey((int)m_bot.Faction);
            m_selectAITemplateCombobox.SelectItemByKey((int)m_bot.AITemplate.TemplateId);
            m_aggresivitySlider.SetValue(m_bot.Aggressivity);
            m_seeDistanceSlider.SetValue(m_bot.SeeDistance);
            m_selectSmallShipCombobox.SelectItemByKey((int)m_bot.ShipType);
        }
 public override void Load()
 {
     base.Load();
     MyScriptWrapper.ApplyTransition(MyMusicTransitionEnum.CalmAtmosphere); // Sets music group to be played in the sector - no matter if the mission is running or not
     m_botDetector = MyScriptWrapper.GetDetector(m_botDetectorId);
     m_botDetector.On();
     m_botDetector.OnEntityEnter += m_botDetector_OnEntityEnter;
     m_botToTalk = MyScriptWrapper.GetEntity(m_botToTalkId) as MySmallShipBot;
     m_botToTalk.SpeedModifier = 0.25f;
     SetPatrolMode();
     
     Debug.Assert(m_botToTalk != null);                
 }
예제 #4
0
        private static void ShowBotInDebug(MySmallShipBot bot)
        {
            MyHudEntityParams hudParams = new MyHudEntityParams();
            hudParams.DisplayFactionRelation = new MyHudDisplayFactionRelation(true, true, true);

            MyMwcUtils.ClearStringBuilder(m_hudDebugText);
            if (!string.IsNullOrEmpty(bot.DisplayName))
            {
                m_hudDebugText.AppendLine(bot.DisplayName);
            }

            if (MyGuiManager.GetScreenDebugBot() != null)
            {
                MyMwcUtils.AppendStringBuilder(m_hudDebugText, bot.GetDebugHudString());
            }

            hudParams.Text = m_hudDebugText;
            hudParams.MaxDistance = 0f;
            hudParams.FlagsEnum = MyHudIndicatorFlagsEnum.SHOW_TEXT | MyHudIndicatorFlagsEnum.SHOW_HEALTH_BARS | MyHudIndicatorFlagsEnum.SHOW_DISTANCE | MyHudIndicatorFlagsEnum.SHOW_MISSION_MARKER | MyHudIndicatorFlagsEnum.SHOW_FACTION_RELATION_MARKER;

            AddDirectionIndicator(bot, hudParams);
            
        }
        public override void Unload()
        {
            base.Unload();

            MyScriptWrapper.FadedOut -= MyScriptWrapperOnFadedOut;
            MyScriptWrapper.OnSpawnpointBotSpawned -= MyScriptWrapperOnOnSpawnpointBotSpawned;
            MyScriptWrapper.OnBotReachedWaypoint -= MyScriptWrapperOnOnBotReachedWaypoint;
            MyScriptWrapper.OnDialogueFinished -= MyScriptWrapperOnOnDialogueFinished;
            MyScriptWrapper.OnEntityAtacked -= MyScriptWrapperOnOnEntityAtacked;
            MyScriptWrapper.OnSentenceStarted -= MyScriptWrapper_OnSentenceStarted;

            MyScriptWrapper.SetEntitySaveFlagDisabled(MyScriptWrapper.GetEntity((uint)EntityID.EACMothershipContainer1));
            MyScriptWrapper.SetEntitySaveFlagDisabled(MyScriptWrapper.GetEntity((uint)EntityID.EACMothershipContainer2));

            MyScriptWrapper.SetGameVolume(m_gameVolume);

            m_ravenGuy = null;
            m_ravenGirl = null;
            m_marcus = null;
            m_madelyn = null;
            m_madelynTurrets = null;

            MyScriptWrapper.EnableDetaching();
            MyScriptWrapper.SwitchTowerPrevious -= MyScriptWrapper_SwitchTowerPrevious;
            MyScriptWrapper.SwitchTowerNext -= MyScriptWrapper_SwitchTowerNext;

            if (MyScriptWrapper.IsMissionFinished(this.ID))
            {
                MyScriptWrapper.TravelToMission(MyMissionID.RIFT);
            }
        }
        public override void Load()
        {
            EnableCorrectBarths((uint)EntityID.ThomasBartId, (uint)EntityID._01SmallShipBarth);

            MyGuiScreenGamePlay.Static.CameraContrlolledObjectChanged += Static_CameraContrlolledObjectChanged;
            MyScriptWrapper.EntityClosing += MyScriptWrapperOnEntityClosing;
            MyScriptWrapper.AlarmLaunched += MyScriptWrapperOnAlarmLaunched;
            MyScriptWrapper.SpawnpointBotsKilled += MyScriptWrapperOnSpawnpointBotsKilled;
            MyScriptWrapper.OnBotReachedWaypoint += MyScriptWrapperOnOnBotReachedWaypoint;
            MyScriptWrapper.OnDialogueFinished += MyScriptWrapperOnOnDialogueFinished;
            MyScriptWrapper.OnEntityAtacked += MyScriptWrapperOnEntityAttacked;

            if (!MyMissions.GetMissionByID(MyMissionID.BARTHS_MOON_TRANSMITTER_TALK_TO_BARTH).IsCompleted())
            {
                var startPosition = MyScriptWrapper.GetEntity((uint)EntityID.PlayerStartLocationTransmitter).GetPosition();
                MyScriptWrapper.Move(MyScriptWrapper.GetEntity(MyActorConstants.GetActorName(MyActorEnum.MADELYN)), startPosition);
                MyScriptWrapper.MovePlayerAndFriendsToHangar(this.RequiredActors);
            }

            HideContainer(EntityID.InvisibleContainer1);
            HideContainer(EntityID.InvisibleContainer2);
            HideContainer(EntityID.InvisibleContainer3);
            //HideContainer(EntityID.HidePrefabCont);
            MyScriptWrapper.SetEntityEnabled((uint)EntityID.BarthsMoon2DisableInfluenceSphere, false);
            MyScriptWrapper.TryHideEntities(m_hidePrefabs);
            MyScriptWrapper.SetEntitiesEnabled(m_disableDummies, false);
            //InitDetector((uint)EntityID.EnterMainLabDetector, StartMainLabDetector);
            MyScriptWrapper.OnSentenceStarted += MyScriptWrapper_OnSentenceStarted;

            MyEntityDetector detector = MyScriptWrapper.GetDetector(MyScriptWrapper.GetEntity((uint)EntityID.EscapeEventDummy));
            detector.OnEntityEnter += (OnEntityEnter)EscapeEvent;
            detector.On();


            foreach (uint deadShip in m_deadShips)
            {
                MyEntity shipEntity = MyScriptWrapper.TryGetEntity(deadShip);
                if (shipEntity != null)
                {
                    MyScriptWrapper.DisableShip(MyScriptWrapper.GetEntity(deadShip), false);
                    MyScriptWrapper.RemoveEntityMark(MyScriptWrapper.GetEntity(deadShip));
                }
            }


            m_thomasBarth = (MySmallShipBot)MyScriptWrapper.GetEntity((uint)EntityID.ThomasBartId);
            m_thomasBarth.SpeedModifier = 0.5f;

            ActivateTurretsObjects(m_turrets1, false);
            ActivateTurretsObjects(m_turrets2, false);
            ActivateTurretsObjects(m_turrets3, false);


            foreach (var entity in m_whiteMarks)
            {
                var en = MyScriptWrapper.TryGetEntity(entity);

                if (en != null)
                {
                    var name = "";
                    if (en.Name != null) name = en.Name;
                    if (en.DisplayName != null) name = en.DisplayName;
                    //TODO: can't we just remove SHOW_TEXT?
                    MyScriptWrapper.MarkEntity(en, name, HUD.MyHudIndicatorFlagsEnum.SHOW_DISTANCE | HUD.MyHudIndicatorFlagsEnum.SHOW_TEXT | MyHudIndicatorFlagsEnum.ALPHA_CORRECTION_BY_DISTANCE, HUD.MyGuitargetMode.Neutral);
                }
            }


            m_computerDownDialoguePlayed = false;

            var prefabCont = MyScriptWrapper.GetEntity((uint)EntityID.BuildContainer4);

            foreach (var child in prefabCont.Children)
            {
                if (child.Physics != null) child.Physics.Enabled = false;
                MyScriptWrapper.Highlight(child.EntityId.Value.NumericValue, true, this);
            }

            m_thomasBarth.SetWaypointPath("interior2");
            m_thomasBarth.PatrolMode = MyPatrolMode.CYCLE;
            m_thomasBarth.Patrol();

            MyScriptWrapper.TryHideEntities(m_entitiesToHide);
            //MyScriptWrapper.TryHideEntities(new List<uint>(){(uint)EntityID._01SmallShipBarth});

            m_turrets1.Clear();
            m_turrets1.AddRange(m_turrets1Waves);
            m_turrets2.Clear();
            m_turrets2.AddRange(m_turrets2Waves);
            m_turrets3.Clear();
            m_turrets3.AddRange(m_turrets3Waves);

            //MyScriptWrapper.GetEntity("Madelyn").SetWorldMatrix(MyScriptWrapper.GetEntity((uint)EntityID.BarthsMoon2MadelynLocation).WorldMatrix);
            //MySession.PlayerShip.SetWorldMatrix(MyScriptWrapper.GetEntity((uint)EntityID.BarthsMoon2StartLocation).WorldMatrix);

            LoadFanPhysics();

            m_lookedThroughLeftCameras = false;
            m_lookedThroughRightCameras = false;
            base.Load();
        }
예제 #7
0
        public void LinkShip(MySmallShipBot bot)
        {
            SetBotPath(bot);

            foreach (var botShip in m_botShips)
            {
                if (botShip.Builder.ShipType == bot.ShipType)
                {
                    if (botShip.Ship == null)
                    {
                        botShip.Ship = bot;
                        break;
                    }
                }
            }
        }
        public override void Unload()
        {
            if (!IsMainSector) return;

            base.Unload();

            m_protectMadelyn.MissionEntityIDs.Clear();

            m_05PirateShip = null;
            m_05PirateBigShip = null;
            m_barth = null;
            m_detectorToTurretContainerMapping.Clear();
            m_turretContainerToDetectorMapping.Clear();
            m_detectorToParticleMapping.Clear();

            m_attackBarthDetector = null;
             
            MyScriptWrapper.OnUseKeyPress -= Repair_UseKeyPress;
            MyScriptWrapper.OnEntityAtacked -= Script_EntityAtacked;
            MyScriptWrapper.EntityDeath -= Script_EntityDeath;
            MyScriptWrapper.OnSpawnpointBotSpawned -= Script_BotSpawned;
        }
예제 #9
0
 void OnSpawnpointBotSpawned(MyEntity spawnpoint, MyEntity bot)
 {
     if (spawnpoint == MyScriptWrapper.GetEntity(1660))
     {
         m_Speedy = (MySmallShipBot)bot; 
     }   
 }
        public override void Load()
        {
            m_ms1 = MyScriptWrapper.GetEntity((uint)EntityID.MS1);
            m_ms2 = MyScriptWrapper.GetEntity((uint)EntityID.MS2);
            m_ms3 = MyScriptWrapper.GetEntity((uint)EntityID.MS3);
            m_ms4 = MyScriptWrapper.GetEntity((uint)EntityID.MS4);
            m_ms5 = MyScriptWrapper.GetEntity((uint)EntityID.MS5);
            m_ms6 = MyScriptWrapper.GetEntity((uint)EntityID.MS6);
            m_stealMS = MyScriptWrapper.GetEntity((uint)EntityID.MSSteal);
            
            MyScriptWrapper.EnsureInventoryItem(MyScriptWrapper.GetCentralInventory(), MyMwcObjectBuilderTypeEnum.SmallShip_HackingTool, (int)MyMwcObjectBuilder_SmallShip_HackingTool_TypesEnum.Level_2);

            m_marcus = (MySmallShipBot)MyScriptWrapper.GetEntity("Marcus");
            m_tarja = (MySmallShipBot)MyScriptWrapper.GetEntity("RavenGirl");

            MyScriptWrapper.EnablePhysics((uint)EntityID.MS1, false);
            MyScriptWrapper.EnablePhysics((uint)EntityID.MS2, false);
            MyScriptWrapper.EnablePhysics((uint)EntityID.MS3, false);
            MyScriptWrapper.EnablePhysics((uint)EntityID.MS4, false);
            MyScriptWrapper.EnablePhysics((uint)EntityID.MS5, false);
            MyScriptWrapper.EnablePhysics((uint)EntityID.MS6, false);


            m_detector_reachHangar = MyScriptWrapper.GetDetector((uint)EntityID.DetectorReachHangar);
            m_detector_tunnelExplosion = MyScriptWrapper.GetDetector((uint)EntityID.DetectorTunnelExplosion);
            m_detector_ambushExplosion = MyScriptWrapper.GetDetector((uint)EntityID.DetectorAmbushExplosion);
            m_detector_headshake1 = MyScriptWrapper.GetDetector((uint)EntityID.DetectorHeadshake1);
            m_detector_headshake2 = MyScriptWrapper.GetDetector((uint)EntityID.DetectorHeadshake2);
            m_detector_headshake3 = MyScriptWrapper.GetDetector((uint)EntityID.DetectorHeadshake3);
            m_detector_bots1 = MyScriptWrapper.GetDetector((uint)EntityID.DetectorBots1);
            m_detector_bots2 = MyScriptWrapper.GetDetector((uint)EntityID.DetectorBots2);
            m_detector_bots3 = MyScriptWrapper.GetDetector((uint)EntityID.DetectorBots3);
            m_detector_bots4 = MyScriptWrapper.GetDetector((uint)EntityID.DetectorBots4);
            m_detector_bots5 = MyScriptWrapper.GetDetector((uint)EntityID.DetectorBots5);
            m_detector_bots7 = MyScriptWrapper.GetDetector((uint)EntityID.DetectorBots7);
            m_detector_bots8 = MyScriptWrapper.GetDetector((uint)EntityID.DetectorBots8);
            m_detector_bots9 = MyScriptWrapper.GetDetector((uint)EntityID.DetectorBots9);
            m_detector_bots10 = MyScriptWrapper.GetDetector((uint)EntityID.DetectorBots10);
            m_detector_marcusLeave1 = MyScriptWrapper.GetDetector((uint)EntityID.DetectorMarcusLeave1);
            m_detector_marcusLeave2 = MyScriptWrapper.GetDetector((uint)EntityID.DetectorMarcusLeave2);

            MyScriptWrapper.OnBotReachedWaypoint += ReachedWaypoint;
            base.Load();
        }
예제 #11
0
        public override void Load()
        {
            m_shootWarningTime = null;

            /*
            if (MyScriptWrapper.IsMissionFinished(MyMissionID.TWIN_TOWERS_HACKING_CONTINUE))
            {
                for (int i = 1; i < m_friends.Count; i++)
                {
                    m_friends[i].Follow(m_friends[0]);
                }
                m_friends[0].SetWaypointPath("friendPatrol");
                m_friends[0].PatrolMode = MyPatrolMode.CYCLE;
                m_friends[0].Patrol();
            }
            */

            // audio
            MyScriptWrapper.ApplyTransition(MyMusicTransitionEnum.Mystery);

            MyScriptWrapper.OnSpawnpointBotSpawned += OnSpawnpointBotSpawned;
            MyScriptWrapper.OnEntityAtacked += OnEntityAtacked;
            MyScriptWrapper.OnBotReachedWaypoint += OnBotReachedWaypoint;
            MyScriptWrapper.EntityDeath += OnEntityDeath;
            MyScriptWrapper.EntityHacked += OnEntityHacked;

            MyScriptWrapper.OnDialogueFinished += MyScriptWrapperOnDialogueFinished;

            MyScriptWrapper.SetFactionRelation(MyMwcObjectBuilder_FactionEnum.FourthReich, MyMwcObjectBuilder_FactionEnum.Rainiers, MyFactions.RELATION_BEST);

            // deactivate bots in hangar
            foreach (var botID in m_botsInLeftHangars)
            {
                MyEntity bot = MyScriptWrapper.TryGetEntity(botID);
                if (bot != null)
                {
                    MyScriptWrapper.DisableShip(MyScriptWrapper.TryGetEntity(botID));
                }
            }

            foreach (var botID in m_botsInRightHangars)
            {
                MyEntity bot = MyScriptWrapper.TryGetEntity(botID);
                if (bot != null)
                {
                    MyScriptWrapper.DisableShip(MyScriptWrapper.TryGetEntity(botID));
                }
            }

            // hide motherships
            if (!MyScriptWrapper.IsMissionFinished(MyMissionID.TWIN_TOWERS_MOTHERSHIP2))
            {
                MyScriptWrapper.HideEntity(MyScriptWrapper.GetEntity("Madelyn"));
            }

            // get hacker
            m_hacker = MyScriptWrapper.TryGetEntity((uint)EntityID.Bot_Friend_Hacker) as MySmallShipBot;
            MyScriptWrapper.SetEntityDestructible(m_hacker, false);

            if (MyScriptWrapper.IsMissionFinished(MyMissionID.TWIN_TOWERS_RANDEVOUZ))
            {
                MyScriptWrapper.HideEntity(MyScriptWrapper.GetEntity((uint)EntityID.ReichMothership));
            }
            else
            {
                m_explosives = 3;
                m_explosives01 = MyScriptWrapper.TryGetEntity((uint)EntityID.Explosives1);
                HideExplosives(m_explosives01);

                m_explosives02 = MyScriptWrapper.TryGetEntity((uint)EntityID.Explosives2);
                HideExplosives(m_explosives02);

                m_explosives03 = MyScriptWrapper.TryGetEntity((uint)EntityID.Explosives3);
                HideExplosives(m_explosives03);

                m_explosives04 = MyScriptWrapper.TryGetEntity((uint)EntityID.Explosives4);
                HideExplosives(m_explosives04);
            }

            if (MyScriptWrapper.IsMissionFinished(MyMissionID.TWIN_TOWERS_ASSAULT))
            {
                MyScriptWrapper.SetFactionRelation(MyMwcObjectBuilder_FactionEnum.WhiteWolves, MyMwcObjectBuilder_FactionEnum.Rainiers, -100);
                if (!MyScriptWrapper.IsMissionFinished(MyMissionID.TWIN_TOWERS_HACKING_CONTINUE))
                {
                    foreach (var value in m_turrets1)
                    {
                        MyScriptWrapper.SetEntityEnabled(MyScriptWrapper.TryGetEntity(value), false);
                    }
                }
                else
                {
                    MyScriptWrapper.SetEntityEnabled(MyScriptWrapper.TryGetEntity((uint)EntityID.Prefab_Door_LeftCommand1), true);
                    MyScriptWrapper.SetEntityEnabled(MyScriptWrapper.TryGetEntity((uint)EntityID.Prefab_Door_LeftCommand2), true);
                }
            }
            else
            {
                MyScriptWrapper.SetFactionRelation(MyMwcObjectBuilder_FactionEnum.WhiteWolves, MyMwcObjectBuilder_FactionEnum.Rainiers, 100);
            }

            if (MyScriptWrapper.IsMissionFinished(MyMissionID.TWIN_TOWERS_HACKING_CONTINUE))
            {
                ChangeFaction_Phase01();
            }

            if (MyScriptWrapper.IsMissionFinished(MyMissionID.TWIN_TOWERS_GENERATOR))
            {
                MyScriptWrapper.SetEntityEnabled(MyScriptWrapper.GetEntity((uint)EntityID.Objective_Generator), false);
            }

            m_FoRMS = MyScriptWrapper.GetEntity((uint)EntityID.Zeppelin_FoR_1);
            m_WWMS1_Moving = MyScriptWrapper.GetEntity((uint)EntityID.Zeppelin_WW_1_Moving);
            m_WWMS1_Static = MyScriptWrapper.GetEntity((uint)EntityID.Zeppelin_WW_1_Static);
            m_WWMS2 = MyScriptWrapper.GetEntity((uint)EntityID.Zeppelin_WW_2);
            
            if (!MyScriptWrapper.IsMissionFinished(MyMissionID.TWIN_TOWERS_COMMAND))
            {
                MyScriptWrapper.HideEntity(m_WWMS1_Moving, true);
                MyScriptWrapper.HideEntity(m_WWMS1_Static, true);
                MyScriptWrapper.HideEntity(m_WWMS2, true);
                MyScriptWrapper.HideEntity(m_FoRMS, true);
            }
            else
            {
                ChangeFaction_Phase02();
            }

            m_flyWWMS1 = false;
            m_flyWWMS2 = false;
            m_flyFoRMS = false;
            m_WWMS1_passedmark = false;
            m_WWMS2_passedmark = false;
            m_FoRMS_passedmark = false;

            base.Load();

            // To be removed later
            // inventory items
            /*
            MyMwcObjectBuilder_SmallShip_Player originalBuilder = MySession.PlayerShip.GetObjectBuilder(true) as MyMwcObjectBuilder_SmallShip_Player;
            originalBuilder.ShipType = MyMwcObjectBuilder_SmallShip_TypesEnum.HEWER;
            MySession.PlayerShip.Close();
            MyEntities.CreateFromObjectBuilderAndAdd(null, originalBuilder, originalBuilder.PositionAndOrientation.GetMatrix());
             */

            MyScriptWrapper.SetEntityEnabled(MyScriptWrapper.TryGetEntity((uint)EntityID.Prefab_Light_ToDisable_01),true);
            MyScriptWrapper.SetEntityEnabled(MyScriptWrapper.TryGetEntity((uint)EntityID.Prefab_Light_ToDisable_02),true);
            MyScriptWrapper.SetEntityEnabled(MyScriptWrapper.TryGetEntity((uint)EntityID.Prefab_Light_ToEnable_01),false);
            MyScriptWrapper.SetEntityEnabled(MyScriptWrapper.TryGetEntity((uint)EntityID.Prefab_Light_ToEnable_02),false);
        }
예제 #12
0
 public virtual Vector3 GetFormationPosition(MySmallShipBot bot)
 {
     Vector3 centerToBot = bot.GetPosition() - WorldVolume.Center;
     Vector3 centerToBotNormalized = Vector3.Normalize(centerToBot);
     
     return WorldVolume.Center + centerToBotNormalized * (WorldVolume.Radius + MyAIConstants.FORMATION_SPACING);
 }
예제 #13
0
        public override void Load()
        {
            //if (!IsMainSector) return;
            MyScriptWrapper.OnSpawnpointBotSpawned += MyScriptWrapperOnOnSpawnpointBotSpawned;
            MyScriptWrapper.EntityDeath += OnEntityDeath;
            MyGuiScreenGamePlay.Static.CameraContrlolledObjectChanged += Static_CameraContrlolledObjectChanged;



            m_templarBot = (MySmallShipBot)MyScriptWrapper.GetEntity((uint)EntityID.BotTemplar);
            m_royalBot = (MySmallShipBot)MyScriptWrapper.GetEntity((uint)EntityID.BotRoyal);

            m_templarBot.SetWaypointPath("Templar");
            m_templarBot.PatrolMode = MyPatrolMode.CYCLE;
            m_templarBot.SpeedModifier = 0.25f;
            m_templarBot.Patrol();

            m_royalBot.SetWaypointPath("Royal");
            m_royalBot.PatrolMode = MyPatrolMode.CYCLE;
            m_royalBot.SpeedModifier = 0.25f;
            m_royalBot.Patrol();

            m_ravenguyBot = MyScriptWrapper.GetEntity("RavenGuy") as MySmallShipBot;
            m_ravengirlBot = MyScriptWrapper.GetEntity("RavenGirl") as MySmallShipBot;
            m_marcus = MyScriptWrapper.GetEntity("Marcus") as MySmallShipBot;



            MyScriptWrapper.UnhideEntity(MyScriptWrapper.GetEntity((uint)EntityID.BotTemplar));


            m_deadlyScanners = new MyDeadlyScanners(m_scanners1IDs, new List<int>() { 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000 });
            if (!MyScriptWrapper.IsMissionFinished(m_disableScanner2.ID)) 
                Components.Add(m_deadlyScanners);
            DisableEntities(new List<uint>() { (uint)EntityID.Scanner1, (uint)EntityID.Scanner2 });
            
            foreach (var mine in m_minesDummies)
            {
                MyScriptWrapper.GenerateMinesField<MyMineBasic>(MyScriptWrapper.GetEntity(mine),
                                                                MyMwcObjectBuilder_FactionEnum.Russian_KGB, 1, MyTexts.Mine,
                                                                MyHudIndicatorFlagsEnum.SHOW_BORDER_INDICATORS |
                                                                MyHudIndicatorFlagsEnum.ALPHA_CORRECTION_BY_DISTANCE |
                                                                MyHudIndicatorFlagsEnum.SHOW_TEXT |
                                                                MyHudIndicatorFlagsEnum.SHOW_DISTANCE |
                                                                MyHudIndicatorFlagsEnum.SHOW_FACTION_RELATION_MARKER |
                                                                MyHudIndicatorFlagsEnum.SHOW_ONLY_IF_DETECTED_BY_RADAR
            );
            }

            if (MySession.Static.EventLog.IsMissionFinished(MyMissionID.FORT_VALIANT_C_FOLLOW_FIND_VENTILATION) && !MySession.Static.EventLog.IsMissionFinished(MyMissionID.FORT_VALIANT_C_CATACOMBS))
            {
                SetFriendsPatrol();
            }

            if (!MyMissions.GetMissionByID(MyMissionID.FORT_VALIANT_C_CAPTAIN).IsCompleted())
            {
                var startPosition = MyScriptWrapper.GetEntity((uint)EntityID.StartLocationC).GetPosition();
                MyScriptWrapper.Move(MyScriptWrapper.GetEntity(MyActorConstants.GetActorName(MyActorEnum.MADELYN)), startPosition);
                MyScriptWrapper.MovePlayerAndFriendsToHangar(this.RequiredActors);
            }
            

            base.Load();
        }
예제 #14
0
        public override void Unload()
        {
            //if (!IsMainSector) return;
            MyScriptWrapper.OnSpawnpointBotSpawned -= MyScriptWrapperOnOnSpawnpointBotSpawned;
            MyScriptWrapper.EntityDeath -= OnEntityDeath;
            MyGuiScreenGamePlay.Static.CameraContrlolledObjectChanged -= Static_CameraContrlolledObjectChanged;
            Components.Clear();

            m_ravenguyBot = null;
            m_ravengirlBot = null;
            m_marcus = null;
            m_templarBot = null;
            m_royalBot = null;

            base.Unload();
        }
예제 #15
0
        public override void Load()
        {
            if (!IsMainSector)
                return;

            foreach (var item in m_staticAsteroidRubble)
            {
                MyScriptWrapper.HideEntity(MyScriptWrapper.GetEntity(item));
            }
            MyScriptWrapper.HideEntity(MyScriptWrapper.GetEntity((uint)EntityID.Influence_Sphere_Fallout));

            m_Marcus = MyScriptWrapper.GetEntity("Marcus") as MySmallShipBot;

            m_hangar = MyScriptWrapper.GetEntity((uint)EntityID.Objective01_Hangar);

            MyScriptWrapper.OnSpawnpointBotSpawned += OnSpawnpointBotSpawned;
            MyScriptWrapper.EntityHacked += OnEntityHacked;
            MyScriptWrapper.OnBotReachedWaypoint += OnBotReachedWaypoint;
            MyScriptWrapper.EntityDeath += OnEntityDeath;

            m_MadelynSpeed = 200f;
            m_RussianSpeed = 100f;
            m_laikaBaseCalled = false;

            var pipeDetector = MyScriptWrapper.GetDetector((uint)EntityID.Detector_Pipe);
            pipeDetector.OnEntityEnter += PipeEntered;

            var rightEnteredDetector = MyScriptWrapper.GetDetector((uint)EntityID.Detector_RightEntered);
            rightEnteredDetector.OnEntityEnter += RightEntered;

            var leftEnteredDetector = MyScriptWrapper.GetDetector((uint)EntityID.Detector_LeftEntered);
            leftEnteredDetector.OnEntityEnter += LeftEntered;

            m_Madelyn = MyScriptWrapper.GetEntity("Madelyn");
            m_RussianMS = MyScriptWrapper.GetEntity((uint)EntityID.RussianMothership);
            //MyScriptWrapper.PrepareMotherShipForMove(m_RussianMS);

            foreach (var ship in m_smallShips)
            {
                MyScriptWrapper.DisableShip(MyScriptWrapper.TryGetEntity(ship));
            }

            if (MyScriptWrapper.IsMissionFinished(MyMissionID.LAIKA_GOTO_10))
            {
                ConvertToKGB();
            }
            else
            {
                MyScriptWrapper.SetEntityEnabled(MyScriptWrapper.TryGetEntity((uint)EntityID.Door_ToHangar01), false);
                MyScriptWrapper.SetEntityEnabled(MyScriptWrapper.TryGetEntity((uint)EntityID.Door_ToHangar02), false);
            }

            if (!MyScriptWrapper.AreMissionFinished(new MyMissionID[] { MyMissionID.LAIKA_GOTO_COMMUNICATION_01, MyMissionID.LAIKA_GOTO_COMMUNICATION_02 }))
            {
                HideMothershipToShow();
                MyScriptWrapper.HideEntity(MyScriptWrapper.GetEntity((uint)EntityID.RussianMothership));
            }

            BoundingBox box = MyScriptWrapper.GetEntity((uint)EntityID.Dummy_Remove_stuff_after_explosion).WorldAABB;
            //MyEntities.GetIntersectionWithSphere(ref sphere, null, null, true, false, ref entitiesAfterExplosion);
            List<MyEntity> entitiesAfterExplosion = MyGamePruningStructure.GetAllEntitiesInBox(ref box, MyGamePruningStructure.QueryFlags.Others);
            m_entitiesAfterExplosion.Clear();
            foreach (MyEntity entity in entitiesAfterExplosion)
            {
                if (entity.EntityId.HasValue)
                {
                    if ((entity is MySmallShipBot) ||
                        (entity is MyCargoBox) ||
                        (entity is MyVoxelMap) ||
                        (entity is MyStaticAsteroid) ||
                        (entity is MyDummyPoint) ||
                        (entity is MyPrefabLight) ||
                        (entity is MyPrefabHangar))
                    {
                        m_entitiesAfterExplosion.Add(entity.EntityId.Value.NumericValue);
                    }
                }
            }

            if (MyScriptWrapper.IsMissionFinished(MyMissionID.LAIKA_GOTO_COMMAND))
            {
                HideMothershipToHide();
                AsteroidDetectorsActivate();

                if (MyScriptWrapper.IsMissionFinished(MyMissionID.LAIKA_GOTO_COMMUNICATION_01) || MyScriptWrapper.IsMissionFinished(MyMissionID.LAIKA_GOTO_COMMUNICATION_02))
                {
                    MyScriptWrapper.DestroyEntities(new List<uint> { (uint)EntityID.GrilleToDestroy });
                    MyScriptWrapper.ActivateSpawnPoint((uint)EntityID.Spawnpoint_ToLeftHub);
                    MyScriptWrapper.ActivateSpawnPoint((uint)EntityID.Spawnpoint_ToRightHub);
                    if (MyScriptWrapper.IsMissionFinished(MyMissionID.LAIKA_GOTO_COMMUNICATION_01) == MyScriptWrapper.IsMissionFinished(MyMissionID.LAIKA_GOTO_COMMUNICATION_02))
                    {
                        SetHoundDetectorsBase();
                    }
                    else
                    {
                        if (!MyScriptWrapper.IsEntityDead((uint)EntityID.PipeToDestroy))
                        {
                            pipeDetector.On();
                        }
                        /*
                        if (MyScriptWrapper.IsMissionFinished(MyMissionID.LAIKA_GOTO_COMMUNICATION_01))
                        {
                            MyScriptWrapper.PlayDialogue(MyDialogueEnum.LAIKA_0720_AFTERLEFTHUB);
                        } */
                    }
                }
                else
                {
                    MyEntityDetector playerInPipesDetector = MyScriptWrapper.GetDetector((uint)EntityID.Detector_PlayerInPipes);
                    playerInPipesDetector.OnEntityEnter += PlayerInPipes;
                    playerInPipesDetector.On();
                }

                if (MyScriptWrapper.IsMissionFinished(MyMissionID.LAIKA_GOTO_COMMUNICATION_01) && !MyScriptWrapper.IsMissionFinished(MyMissionID.LAIKA_GOTO_COMMUNICATION_02))
                {
                    SetHoundDetectorsLeft();
                }
                else if (MyScriptWrapper.IsMissionFinished(MyMissionID.LAIKA_GOTO_COMMUNICATION_02) && !MyScriptWrapper.IsMissionFinished(MyMissionID.LAIKA_GOTO_COMMUNICATION_01))
                {
                    SetHoundDetectorsRight();
                }

                if (MyScriptWrapper.IsMissionFinished(MyMissionID.LAIKA_GOTO_COMMUNICATION_02))
                {
                    RestartRussian();
                    RestartMadelyn();
                }
                else
                {
                    StopRussian();
                    //StopMadelyn();
                }
            }

            base.Load();
        }
예제 #16
0
        public override void Unload()
        {
            base.Unload();

            MyScriptWrapper.OnDialogueFinished -= MyScriptWrapperOnDialogueFinished;

            MyScriptWrapper.OnSpawnpointBotSpawned -= OnSpawnpointBotSpawned;
            MyScriptWrapper.OnEntityAtacked -= OnEntityAtacked;
            MyScriptWrapper.OnBotReachedWaypoint -= OnBotReachedWaypoint;
            MyScriptWrapper.EntityDeath -= OnEntityDeath;
            MyScriptWrapper.EntityHacked -= OnEntityHacked;

            m_hacker = null;
            m_explosives01 = null;
            m_explosives02 = null;
            m_explosives03 = null;
            m_explosives04 = null;
            m_FoRMS = null;
            m_WWMS1_Moving = null;
            m_WWMS1_Static = null;
            m_WWMS2 = null;
        }
예제 #17
0
        public override void Unload()
        {
            base.Unload();

            MyScriptWrapper.OnSpawnpointBotSpawned -= OnSpawnpointBotSpawned;
            MyScriptWrapper.EntityHacked -= OnEntityHacked;
            MyScriptWrapper.OnBotReachedWaypoint -= OnBotReachedWaypoint;
            MyScriptWrapper.EntityDeath -= OnEntityDeath;

            m_Marcus = null;
            m_Madelyn = null;
            m_hangar = null;
            m_RussianMS = null;
        }
예제 #18
0
 private static void SetupTarja(int missionNumber, MySmallShipBot tarja)
 {
     if (tarja != null)
     {
         tarja.Engine = new MyMwcObjectBuilder_SmallShip_Engine(MyMwcObjectBuilder_SmallShip_Engine_TypesEnum.Nuclear_1);
         tarja.SetEquip(new List<MyMwcObjectBuilder_SmallShip_Weapon>
             {
                 new MyMwcObjectBuilder_SmallShip_Weapon(MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Autocanon),
                 new MyMwcObjectBuilder_SmallShip_Weapon(MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Autocanon),
                 new MyMwcObjectBuilder_SmallShip_Weapon(MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Missile_Launcher),
             },
             new List<MyMwcObjectBuilder_InventoryItem>
             {
                 new MyMwcObjectBuilder_InventoryItem(new MyMwcObjectBuilder_SmallShip_Ammo(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Autocannon_Basic), 100),
                 new MyMwcObjectBuilder_InventoryItem(new MyMwcObjectBuilder_SmallShip_Ammo(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Guided_Missile_Visual_Detection), 10),
             });
     }
 }
        public override void Unload()
        {
            MyScriptWrapper.EntityHacked -= MyScriptWrapper_EntityHackedAfterExplosion;
            MyScriptWrapper.EntityHacked -= MyScriptWrapperEntityHackedFirstKey;
            MyScriptWrapper.OnBotReachedWaypoint -= ReachedWaypoint;
            m_detector_bots1.Off();
            m_detector_bots1.OnEntityEnter -= SpawnBotsDetectorEntered;
            m_detector_bots2.Off();
            m_detector_bots2.OnEntityEnter -= SpawnBotsDetectorEntered;
            m_detector_bots3.Off();
            m_detector_bots3.OnEntityEnter -= SpawnBotsDetectorEntered;
            m_detector_bots4.Off();
            m_detector_bots4.OnEntityEnter -= SpawnBotsDetectorEntered;
            m_detector_bots5.Off();
            m_detector_bots5.OnEntityEnter -= SpawnBotsDetectorEntered;
            m_detector_bots7.Off();
            m_detector_bots7.OnEntityEnter -= SpawnBotsDetectorEntered;
            m_detector_bots8.Off();
            m_detector_bots8.OnEntityEnter -= SpawnBotsDetectorEntered;
            m_detector_bots9.Off();
            m_detector_bots9.OnEntityEnter -= SpawnBotsDetectorEntered;
            m_detector_bots10.Off();
            m_detector_bots10.OnEntityEnter -= SpawnBotsDetectorEntered;
            base.Unload();

            m_ms1 = null;
            m_ms2 = null;
            m_ms3 = null;
            m_ms4 = null;
            m_ms5 = null;
            m_ms6 = null;
            m_stealMS = null;

            m_marcus = null;
            m_tarja = null;

            m_detector_reachHangar = null;
            m_detector_tunnelExplosion = null;
            m_detector_ambushExplosion = null;
            m_detector_headshake1 = null;
            m_detector_headshake2 = null;
            m_detector_headshake3 = null;
            m_detector_bots1 = null;
            m_detector_bots2 = null;
            m_detector_bots3 = null;
            m_detector_bots4 = null;
            m_detector_bots5 = null;
            m_detector_bots7 = null;
            m_detector_bots8 = null;
            m_detector_bots9 = null;
            m_detector_bots10 = null;
            m_detector_marcusLeave1 = null;
            m_detector_marcusLeave2 = null;

            if (MyScriptWrapper.IsMissionFinished(this.ID))
            {
                MyScriptWrapper.TravelToMission(MyMissionID.CHINESE_REFINERY); //Chinese refinery
            }
        }
예제 #20
0
 private static void SetupValentin(int missionNumber, MySmallShipBot valentin)
 {
     if (valentin != null)
     {
         valentin.Engine = new MyMwcObjectBuilder_SmallShip_Engine(MyMwcObjectBuilder_SmallShip_Engine_TypesEnum.Nuclear_1);
         valentin.SetEquip(new List<MyMwcObjectBuilder_SmallShip_Weapon>
             {
                 new MyMwcObjectBuilder_SmallShip_Weapon(MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Machine_Gun),
                 new MyMwcObjectBuilder_SmallShip_Weapon(MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Machine_Gun),
                 new MyMwcObjectBuilder_SmallShip_Weapon(MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Missile_Launcher),
             },
             new List<MyMwcObjectBuilder_InventoryItem>
             {
                 new MyMwcObjectBuilder_InventoryItem(new MyMwcObjectBuilder_SmallShip_Ammo(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Machine_Gun_Basic), 100),
                 new MyMwcObjectBuilder_InventoryItem(new MyMwcObjectBuilder_SmallShip_Ammo(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Guided_Missile_Visual_Detection), 10),
             });
     }
 }
        public override void Load()
        {
            if (!IsMainSector) return;
            

            m_buildProgress = new MyGuiScreenUseProgressBar(MyTextsWrapperEnum.Turrets, MyTextsWrapperEnum.BuildingInProgress, 0f, MySoundCuesEnum.SfxProgressBuild, MySoundCuesEnum.SfxCancelBuild, MyGameControlEnums.USE, 0, 3000, 0);
            m_buildProgress.OnCanceled += Build_Canceled;
            m_buildProgress.OnSuccess += Build_Success;

            m_repairProgress = new MyGuiScreenUseProgressBar(MyTextsWrapperEnum.Turret, MyTextsWrapperEnum.ProgressRepairing, 0f, MySoundCuesEnum.SfxProgressRepair, MySoundCuesEnum.SfxCancelRepair, MyGameControlEnums.USE, 0, 2000, 0);
            m_repairProgress.OnCanceled += Repair_Canceled;
            m_repairProgress.OnSuccess += Repair_Success;

            m_protectMadelyn.MissionEntityIDs.Add(MyScriptWrapper.GetEntity("MadelynsBridge").EntityId.Value.NumericValue);

            MyScriptWrapper.OnEntityAtacked += Script_EntityAtacked;
            MyScriptWrapper.EntityDeath += Script_EntityDeath;
            MyScriptWrapper.OnSpawnpointBotSpawned += Script_BotSpawned;
            MyScriptWrapper.OnUseKeyPress += Repair_UseKeyPress;

            ShowContainer(EntityID._01PirateShip);
            ShowContainer(EntityID._03PortableTurrets);
            ShowContainer(EntityID.BarthsTurrets1);
            ShowContainer(EntityID.BarthsDestroyedBase);
            HideContainer(EntityID.BarthNormalBase);

            HideContainers(m_barthsMoonM1);
            HideContainers(m_barthsMoonM2);
            DisableEntities(m_particleEffectsToDisable);
            EnableEntities(m_particleEffectsToEnable);
            
            EnableCorrectBarths((uint)EntityID._01SmallShipBarth, (uint)EntityID.ThomasBartId);

            MyScriptWrapper.SetEntitiesEnabled(m_disableDummy, false);
            MyScriptWrapper.TryHideEntities(m_setInVisible);
            MyScriptWrapper.TryUnhideEntities(m_setVisible);

            m_05PirateShip = MyScriptWrapper.GetEntity((uint)EntityID._05PirateShip);

            m_05PirateBigShip = MyScriptWrapper.GetEntity((uint)EntityID._05PirateBigShip);

            m_barth = (MySmallShipBot)MyScriptWrapper.GetEntity((uint)EntityID._01SmallShipBarth);

            m_actionKeyString[0] = MyGuiManager.GetInput().GetGameControlTextEnum(MyGameControlEnums.USE);

            if (!MyMissions.GetMissionByID(MyMissionID.BARTHS_MOON_PLANT_SAVE_BARTH).IsCompleted())
            {
                var startPosition = MyScriptWrapper.GetEntity((uint)EntityID.PlayerStartLocationPlant).GetPosition();
                MyScriptWrapper.Move(MyScriptWrapper.GetEntity(MyActorConstants.GetActorName(MyActorEnum.MADELYN)), startPosition);
                MyScriptWrapper.MovePlayerAndFriendsToHangar(this.RequiredActors);
            }

            MyScriptWrapper.HideEntities(m_hidePrefabContainers);

            SetUpTurrets();

            m_attackBarthDetector = MyScriptWrapper.GetDetector((uint)EntityID.BarthAttackDetector);
            m_attackBarthDetector.On();
            m_attackBarthDetector.OnEntityEnter += AttackBarthDetector_Enter;
   
                                      /*
            MySector.FogProperties.FogNear = 1;
            MySector.FogProperties.FogFar = 53182.205f;
            MySector.FogProperties.FogMultiplier = 0.728f;
            MySector.FogProperties.FogBacklightMultiplier = 0;
            MySector.FogProperties.FogColor = MyMath.VectorFromColor(0, 112, 186);
            MySector.ParticleDustProperties.DustBillboardRadius = 168.707f;
            MySector.ParticleDustProperties.DustFieldCountInDirectionHalf = 8.817f;
            MySector.ParticleDustProperties.DistanceBetween = 125.083f;
            MySector.ImpostorProperties[2].Intensity = 1.519f;
            MySector.ImpostorProperties[2].Radius = 2.007f;
            MySector.ImpostorProperties[2].Anim1 = -0.021f;
                                        */
            m_currentDetector = null;

            MyScriptWrapper.SetEntityPriority(MyScriptWrapper.GetEntity("FrontTurretM"), -1);
            MyScriptWrapper.SetEntityPriority(MyScriptWrapper.GetEntity("BackTurretM"), -1);
            MyScriptWrapper.SetEntityPriority(MyScriptWrapper.GetEntity("BottomTurretM"), -1);

            // Show notifications
            HookDamagedTurrets();

            base.Load();

            if (MySession.Static.EventLog.IsMissionFinished(MyMissionID.BARTHS_MOON_PLANT_BUILD_PLANT))
            {
                ShowContainer(EntityID.BuildContainer1);
            }
        }
예제 #22
0
 private static void SetupMarcus(int missionNumber, MySmallShipBot marcus)
 {
     if (marcus != null)
     {
         marcus.Engine = new MyMwcObjectBuilder_SmallShip_Engine(MyMwcObjectBuilder_SmallShip_Engine_TypesEnum.Nuclear_1);
         if (missionNumber <= 1)
         {
             marcus.SetEquip(new List<MyMwcObjectBuilder_SmallShip_Weapon>
                 {
                     new MyMwcObjectBuilder_SmallShip_Weapon(MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Machine_Gun),
                     new MyMwcObjectBuilder_SmallShip_Weapon(MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Machine_Gun),
                 },
             new List<MyMwcObjectBuilder_InventoryItem>
                 {
                     new MyMwcObjectBuilder_InventoryItem(new MyMwcObjectBuilder_SmallShip_Ammo(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Machine_Gun_Basic), 100),
                 });
         }
         else if (missionNumber == 2)
         {
             marcus.SetEquip(new List<MyMwcObjectBuilder_SmallShip_Weapon>
                 {
                     new MyMwcObjectBuilder_SmallShip_Weapon(MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Machine_Gun),
                     new MyMwcObjectBuilder_SmallShip_Weapon(MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Machine_Gun),
                     new MyMwcObjectBuilder_SmallShip_Weapon(MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Shotgun),
                 },
             new List<MyMwcObjectBuilder_InventoryItem>
                 {
                     new MyMwcObjectBuilder_InventoryItem(new MyMwcObjectBuilder_SmallShip_Ammo(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Machine_Gun_Basic), 100),
                     new MyMwcObjectBuilder_InventoryItem(new MyMwcObjectBuilder_SmallShip_Ammo(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Shotgun_Basic), 100),
                 });
         }
         else if (missionNumber == 3)
         {
             marcus.SetEquip(new List<MyMwcObjectBuilder_SmallShip_Weapon>
                 {
                     new MyMwcObjectBuilder_SmallShip_Weapon(MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Machine_Gun),
                     new MyMwcObjectBuilder_SmallShip_Weapon(MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Machine_Gun),
                     new MyMwcObjectBuilder_SmallShip_Weapon(MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Shotgun),
                     new MyMwcObjectBuilder_SmallShip_Weapon(MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Missile_Launcher),
                 },
             new List<MyMwcObjectBuilder_InventoryItem>
                 {
                     new MyMwcObjectBuilder_InventoryItem(new MyMwcObjectBuilder_SmallShip_Ammo(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Machine_Gun_Basic), 100),
                     new MyMwcObjectBuilder_InventoryItem(new MyMwcObjectBuilder_SmallShip_Ammo(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Shotgun_Basic), 100),
                     new MyMwcObjectBuilder_InventoryItem(new MyMwcObjectBuilder_SmallShip_Ammo(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Missile_Basic), 10),
                 });
         }
         else if (missionNumber >= 4)
         {
             marcus.SetEquip(new List<MyMwcObjectBuilder_SmallShip_Weapon>
                 {
                     new MyMwcObjectBuilder_SmallShip_Weapon(MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Machine_Gun),
                     new MyMwcObjectBuilder_SmallShip_Weapon(MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Machine_Gun),
                     new MyMwcObjectBuilder_SmallShip_Weapon(MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Shotgun),
                     new MyMwcObjectBuilder_SmallShip_Weapon(MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Missile_Launcher),
                     new MyMwcObjectBuilder_SmallShip_Weapon(MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Sniper),
                 },
             new List<MyMwcObjectBuilder_InventoryItem>
                 {
                     new MyMwcObjectBuilder_InventoryItem(new MyMwcObjectBuilder_SmallShip_Ammo(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Machine_Gun_Basic), 100),
                     new MyMwcObjectBuilder_InventoryItem(new MyMwcObjectBuilder_SmallShip_Ammo(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Shotgun_Basic), 100),
                     new MyMwcObjectBuilder_InventoryItem(new MyMwcObjectBuilder_SmallShip_Ammo(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Guided_Missile_Visual_Detection), 10),
                     new MyMwcObjectBuilder_InventoryItem(new MyMwcObjectBuilder_SmallShip_Ammo(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Sniper_High_Speed), 10),
                 });
         }
     }
 }
예제 #23
0
        private void SetBotPath(MySmallShipBot bot)
        {
            bot.WaypointPath = MyWayPointGraph.GetPath(m_wayPointPath);
            bot.PatrolMode = PatrolMode;

            //check if any leader present
            Bot leader = m_botShips.Find(s => (s.Ship != null && s.Ship.Leader == null));
            if (leader != null)
            {
                bot.Follow(leader.Ship);
            }
            else if (bot.WaypointPath != null)
            {
                bot.Patrol();
            }

            if (Leader != null)
            {
                bot.Follow(Leader);
            }
        }
        public override void Load() // Code in that block will be called on the load of the sector
        {
            MyScriptWrapper.AlarmLaunched += MyScriptWrapperOnAlarmLaunched;

            MyScriptWrapper.OnHarvesterUse += MyScriptWrapperOnOnHarvesterUse;
            
            MyScriptWrapper.HideEntity(MyScriptWrapper.GetEntity((uint)EntityID.BotTemplar));
            MyScriptWrapper.ApplyTransition(MyMusicTransitionEnum.CalmAtmosphere); // Sets music group to be played in the sector - no matter if the mission is running or not
            MyScriptWrapper.EnableGlobalEvent(World.Global.MyGlobalEventEnum.SunWind, false);
            MyScriptWrapper.EnableGlobalEvent(World.Global.MyGlobalEventEnum.MeteorWind, false);
            MyScriptWrapper.EnableGlobalEvent(World.Global.MyGlobalEventEnum.IceStorm, false);


            m_captain = MyScriptWrapper.GetEntity((uint) EntityID.Captain) as MySmallShipBot;
            m_gateKeeper = MyScriptWrapper.GetEntity((uint) EntityID.GateKeeper) as MySmallShipBot;
            m_captain.SpeedModifier = 0.25f;
            m_gateKeeper.SpeedModifier = 0.25f;

            m_captain.SetWaypointPath("Captain");
            m_captain.PatrolMode = MyPatrolMode.CYCLE;
            m_captain.SpeedModifier = 0.25f;
            m_captain.Patrol();

            m_gateKeeper.SetWaypointPath("GateKeep");
            m_gateKeeper.PatrolMode = MyPatrolMode.CYCLE;
            m_gateKeeper.SpeedModifier = 0.25f;
            m_gateKeeper.Patrol();

            InitDetector((uint)EntityID.Detector1, OnDetecor1Active);
            InitDetector((uint)EntityID.Detector2, OnDetecor2Active);
            InitDetector((uint)EntityID.Detector3, OnDetecor3Active);
            InitDetector((uint)EntityID.Detector4, OnDetecor4Active);
            InitDetector((uint)EntityID.Detector5, OnDetecor5Active);


            base.Load();
        }
        public override void Unload()
        {
            base.Unload();

            m_thomasBarth = null;
            m_controlledDrone = null;

            MyScriptWrapper.OnSentenceStarted -= MyScriptWrapper_OnSentenceStarted;
            MyGuiScreenGamePlay.Static.CameraContrlolledObjectChanged -= Static_CameraContrlolledObjectChanged;
            MyScriptWrapper.EntityClosing -= MyScriptWrapperOnEntityClosing;
            MyScriptWrapper.AlarmLaunched -= MyScriptWrapperOnAlarmLaunched;
            MyScriptWrapper.SpawnpointBotsKilled -= MyScriptWrapperOnSpawnpointBotsKilled;
            MyScriptWrapper.OnBotReachedWaypoint -= MyScriptWrapperOnOnBotReachedWaypoint;
            MyScriptWrapper.OnDialogueFinished -= MyScriptWrapperOnOnDialogueFinished;
            MyScriptWrapper.OnEntityAtacked -= MyScriptWrapperOnEntityAttacked;
        }
예제 #26
0
        public override Vector3 GetFormationPosition(MySmallShipBot bot)
        {
            int followerIndex = Followers.IndexOf(bot);
            if (followerIndex < 0)
            {
                System.Diagnostics.Debug.Fail("GetFormationPosition - Follower not found!");
                return bot.GetPosition();
            }

            return GetFormationPosition(followerIndex);
        }
        public override void Load()
        {
            //Because he has different position from junkyard race
            MyEntity manjeet = MyScriptWrapper.GetEntity((int)EntityID.FlyToManjeet);
            manjeet.SetPosition(new Vector3(-7529.0f, -3368.0f, 5938.0f));

            m_marcusForCrashDialoguePlayed = false;

            MyScriptWrapper.OnSpawnpointBotSpawned += MyScriptWrapperOnOnSpawnpointBotSpawned;
            MyScriptWrapper.OnBotReachedWaypoint += MyScriptWrapperOnOnBotReachedWaypoint;
            MyScriptWrapper.OnDialogueFinished += MyScriptWrapperOnOnDialogueFinished;
            MyScriptWrapper.OnEntityAtacked += MyScriptWrapperOnOnEntityAtacked;

            MyScriptWrapper.ApplyTransition(MyMusicTransitionEnum.CalmAtmosphere, 0, "KA01");
            MyScriptWrapper.OnSentenceStarted += MyScriptWrapper_OnSentenceStarted;

            m_speakWithPoliceDialogueFinished = false;

            m_ravenGuy = (MySmallShipBot)MyScriptWrapper.GetEntity(MyActorConstants.GetActorName(MyActorEnum.VALENTIN));
            m_ravenGuy.SleepDistance = 8000;

            m_gameVolume = MyScriptWrapper.GetGameVolume();

            m_ravenGirl = (MySmallShipBot)MyScriptWrapper.GetEntity(MyActorConstants.GetActorName(MyActorEnum.TARJA));
            m_ravenGirl.SleepDistance = 8000;

            m_marcus = (MySmallShipBot)MyScriptWrapper.GetEntity(MyActorConstants.GetActorName(MyActorEnum.MARCUS));
            m_marcus.SleepDistance = 8000;

            m_madelyn = MyScriptWrapper.GetEntity(MyActorConstants.GetActorName(MyActorEnum.MADELYN));
            MyScriptWrapper.SetEntityDestructible(m_madelyn, false);
            m_madelyn.SetWorldMatrix(MyScriptWrapper.GetEntity((uint)EntityID.MadelynStart).WorldMatrix);

            m_madelynTurrets = new MyPrefabLargeWeapon[3];
            m_madelynTurrets[0] = (MyPrefabLargeWeapon)MyScriptWrapper.GetEntity("BackTurretM");
            m_madelynTurrets[1] = (MyPrefabLargeWeapon)MyScriptWrapper.GetEntity("FrontTurretM");
            m_madelynTurrets[2] = (MyPrefabLargeWeapon)MyScriptWrapper.GetEntity("BottomTurretM");

            MyScriptWrapper.SetEntityPriority(MyScriptWrapper.GetEntity((uint) EntityID.EACMothershipContainer1), -1, true);
            MyScriptWrapper.SetEntityPriority(MyScriptWrapper.GetEntity((uint) EntityID.EACMothershipContainer2), -1, true);

            m_ravenGuyIn = false;
            m_madelynMoving = false;
            m_madelynMoving2 = false;
            m_desperationFadeout = false;

            base.Load();
        }
        public void SpawnBot(MySpawnPoint spawnPoint, MySmallShipBot bot, int botsIdx, Vector3 spawnPosition)
        {
            MyEventSpawnBot msg = new MyEventSpawnBot();
            msg.SpawnPointId = (uint)spawnPoint.EntityId.Value.NumericValue;
            msg.DesiredBotId = (uint)bot.EntityId.Value.NumericValue;
            msg.BotsIdx = botsIdx;
            msg.SpawnPosition = spawnPosition;

            LogDevelop(string.Format("SpawnBot(SpawnPointId = {0}, DesiredBotId = {1}, BotsIdx = {2})", msg.SpawnPointId, msg.DesiredBotId, msg.BotsIdx));

            Peers.SendToAll(ref msg, NetDeliveryMethod.ReliableOrdered);
        }
예제 #29
0
        /// <summary>
        /// For debugging, add text to the debug screen which details the state of this bot.
        /// TODO: Move this to MyGuiScreenDebugBot. That class is specific to bot so this stuff could/should go there.
        /// </summary>
        /// <param name="bot">Computer-controlled ship.</param>
        /// <param name="player">The bot's target.</param>
        public static void AddToFrameDebugText(MySmallShipBot bot, MySmallShip player)
        {
            // Get a reference to the debug screen.
            MyGuiScreenDebugBot debugScreen = MyGuiManager.GetScreenDebugBot();
            
            if (debugScreen != null)
            {
                // Here's the bot info we're adding to the debug screen text.
                debugScreen.AddToFrameDebugText("MyPhysObjectBot");

                // Hello.
                debugScreen.AddToFrameDebugText("   Message: Hello!");

                // Position.
                debugScreen.AddToFrameDebugText("   Player.Position: " + MyUtils.GetFormatedVector3(player.GetPosition(), 0));

                // Offest between bot and player.
                Vector3 playerPos = player.GetPosition();
                Vector3 botPos = bot.GetPosition();
                Vector3 botToPlayer = botPos - playerPos;
                debugScreen.AddToFrameDebugText("   BotToPlayer: " + botToPlayer.ToString());

                // Offest between player and bot.
                Vector3 playerToBot = playerPos - botPos;
                debugScreen.AddToFrameDebugText("   PlayerToBot: " + playerToBot.ToString());

                // Bot forward
                Vector3 forward = bot.WorldMatrix.Forward;
                debugScreen.AddToFrameDebugText("   Bot.WorldMatrix.Forward: " + MyUtils.GetFormatedVector3(forward, 0));

                // m_playersRelativePosition
                //debugScreen.AddToFrameDebugText("   Bot.m_playersRelativePosition: " + MyUtils.GetFormatedVector3(bot.Behavior.TargetsRelativePosition, 0));

                // Aimed at player?
                //debugScreen.AddToFrameDebugText("   Bot.IsAimedAtPlayer: " + bot.IsBotPrettyMuchAimedAtPlayer());

                // Distance to player.
                //debugScreen.AddToFrameDebugText("   Bot.DistanceToPlayer: " + ((int)(bot.DistanceTo(bot.Decision.Target))).ToString());

                // Rotation indicator.
                //debugScreen.AddToFrameDebugText("   Bot.RotationIndicator: " + MyUtils.GetFormatedVector2(bot.RotationIndicator, 1));

                // Blank line.
                debugScreen.AddToFrameDebugText(" ");
            }
        }
예제 #30
0
        public MyRacer(MySmallShipBot bot, string name, string path, float dialogPorbability, float slowSpeed = 0.9f, float normalSpeed = 1.3f,
                       float fastSpeed = 1.6f, float slowDownDistance = 250f, float shootDistance = 100f)
        {
            m_racerId = bot.EntityId.Value.NumericValue;
            m_wayPointPath = path;
            SlowDownDistance = slowDownDistance;
            SlowSpeed = slowSpeed;
            NormalSpeed = normalSpeed;
            FastSpeed = fastSpeed;
            Name = name;
            DialogPorobability = dialogPorbability;
            ShootDistance = shootDistance;

        }