コード例 #1
0
        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();
        }
コード例 #2
0
        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();
        }
コード例 #3
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();
        }