public override void Load() // Code in that block will be called on the load of the sector
        {
             base.Load();

             m_Detector1 = MyScriptWrapper.GetDetector(MyScriptWrapper.GetEntity((uint)EntityID.Detector1));
            m_Detector1.OnEntityEnter += Detector1Action;
            m_Detector1.On();

            m_Detector2 = MyScriptWrapper.GetDetector(MyScriptWrapper.GetEntity((uint)EntityID.Detector2));
            m_Detector2.OnEntityEnter += Detector2Action;
            m_Detector2.On();

            m_Detector3 = MyScriptWrapper.GetDetector(MyScriptWrapper.GetEntity((uint)EntityID.Detector3));
            m_Detector3.OnEntityEnter += Detector3Action;
            m_Detector3.On();

            m_Detector4 = MyScriptWrapper.GetDetector(MyScriptWrapper.GetEntity((uint)EntityID.Detector4));
            m_Detector4.OnEntityEnter += Detector4Action;
            m_Detector4.On();



            MyScriptWrapper.ApplyTransition(MyMusicTransitionEnum.HeavyFight, 3); // Sets music group to be played in the sector - no matter if the mission is running or not
            MyScriptWrapper.SetPlayerFaction(MyMwcObjectBuilder_FactionEnum.Rainiers);


        }
예제 #2
0
 public override void Load(MyMissionBase sender)
 {
     m_detector = MyScriptWrapper.GetDetector(MyScriptWrapper.GetEntity(m_detectorId));
     m_detector.On();
     m_detector.OnEntityEnter += DetectorOnOnEntityEnter;
     MyScriptWrapper.OnDialogueFinished += MyScriptWrapperOnOnDialogueFinished;
     base.Load(sender);
 }
 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
        public override void Load(MyMissionBase sender)
        {
            base.Load(sender);

            m_detector = MyScriptWrapper.GetDetector(m_detectorID);
            if (m_detector != null)
            {
                m_detector.OnEntityEnter += OnDetector;
                m_detector.On();
            }

            m_currentWave = 0;
            m_spawnedBots = new List<MyEntity>();
        }
        public override void Load() // Code in that block will be called on the load of the sector
        {
            base.Load();

            MyScriptWrapper.ApplyTransition(MyMusicTransitionEnum.HeavyFight, 3); // Sets music group to be played in the sector - no matter if the mission is running or not

            TimeSpan respawnTime = TimeSpan.FromSeconds(60);
            MyScriptWrapper.SetCargoRespawn((uint)EntityID.Cargo1, respawnTime);
            MyScriptWrapper.SetCargoRespawn((uint)EntityID.Cargo2, respawnTime);
            MyScriptWrapper.SetCargoRespawn((uint)EntityID.Cargo3, respawnTime);
            MyScriptWrapper.SetCargoRespawn((uint)EntityID.Cargo4, respawnTime);
            MyScriptWrapper.SetCargoRespawn((uint)EntityID.Cargo5, respawnTime);
            MyScriptWrapper.SetCargoRespawn((uint)EntityID.Cargo6, respawnTime);
            MyScriptWrapper.SetCargoRespawn((uint)EntityID.Cargo7, respawnTime);
            MyScriptWrapper.SetCargoRespawn((uint)EntityID.Cargo8, respawnTime);
            MyScriptWrapper.SetCargoRespawn((uint)EntityID.Cargo9, respawnTime);
            MyScriptWrapper.SetCargoRespawn((uint)EntityID.Cargo10, respawnTime);
            MyScriptWrapper.SetCargoRespawn((uint)EntityID.Cargo11, respawnTime);
            MyScriptWrapper.SetCargoRespawn((uint)EntityID.Cargo12, respawnTime);


            m_Detector1 = MyScriptWrapper.GetDetector(MyScriptWrapper.GetEntity((uint)EntityID.Detector1));
            m_Detector1.OnEntityEnter += Detector1Action;
            m_Detector1.On();

            m_Detector2 = MyScriptWrapper.GetDetector(MyScriptWrapper.GetEntity((uint)EntityID.Detector2));
            m_Detector2.OnEntityEnter += Detector2Action;
            m_Detector2.On();

            m_Detector3 = MyScriptWrapper.GetDetector(MyScriptWrapper.GetEntity((uint)EntityID.Detector3));
            m_Detector3.OnEntityEnter += Detector3Action;
            m_Detector3.On();

        }
        public override void Load() // Code in that block will be called on the load of the sector
        {
            base.Load();

            // Ensure correct game state
            MyScriptWrapper.SetPlayerFaction(MyMwcObjectBuilder_FactionEnum.Rainiers);
            MyScriptWrapper.SetFactionRelation(MyMwcObjectBuilder_FactionEnum.Rainiers, MyMwcObjectBuilder_FactionEnum.Euroamerican, MyFactions.RELATION_NEUTRAL);
            MyScriptWrapper.EnsureInventoryItem(MyScriptWrapper.GetCentralInventory(), MyMwcObjectBuilderTypeEnum.SmallShip_HackingTool, (int)MyMwcObjectBuilder_SmallShip_HackingTool_TypesEnum.Level_2);
            
            if (MySession.Static.EventLog.IsMissionFinished(MyMissionID.RESEARCH_VESSEL_INTRO))
            {
                MyScriptWrapper.SetFactionRelation(MyMwcObjectBuilder_FactionEnum.Rainiers, MyMwcObjectBuilder_FactionEnum.Euroamerican, MyFactions.RELATION_WORST);    
            }

            var bridgeDetector = MyScriptWrapper.GetDetector(MyScriptWrapper.GetEntity((uint)EntityID.BridgeDetector));
            bridgeDetector.OnEntityEnter += BridgeDetectorAction;
            bridgeDetector.On();

            m_generatorDetector1 = MyScriptWrapper.GetDetector(MyScriptWrapper.GetEntity((uint)EntityID.GeneratorDetector1));
            m_generatorDetector1.OnEntityEnter += GeneratorDetector_Enter;
            m_generatorDetector1.On();

            m_generatorDetector2 = MyScriptWrapper.GetDetector(MyScriptWrapper.GetEntity((uint)EntityID.GeneratorDetector1));
            m_generatorDetector2.OnEntityEnter += GeneratorDetector_Enter;
            m_generatorDetector2.On();

            m_generatorDetector3 = MyScriptWrapper.GetDetector(MyScriptWrapper.GetEntity((uint)EntityID.GeneratorDetector1));
            m_generatorDetector3.OnEntityEnter += GeneratorDetector_Enter;
            m_generatorDetector3.On();

            var detectorNearHub1 = MyScriptWrapper.GetDetector((uint)EntityID.DummyNearHub1);
            detectorNearHub1.OnEntityEnter += new OnEntityEnter(DetectorNearHub1_Enter);
            detectorNearHub1.On();

            var detectorNearHub2 = MyScriptWrapper.GetDetector((uint)EntityID.DummyNearHub2);
            detectorNearHub2.OnEntityEnter += new OnEntityEnter(DetectorNearHub2_Enter);
            detectorNearHub2.On();

            var detectorNearHub3 = MyScriptWrapper.GetDetector((uint)EntityID.DummyNearHub3);
            detectorNearHub3.OnEntityEnter += new OnEntityEnter(DetectorNearHub3_Enter);
            detectorNearHub3.On();

            var detect1 = MyScriptWrapper.GetDetector(MyScriptWrapper.GetEntity((uint)EntityID.detect1));
            detect1.OnEntityEnter += Detector1_Enter;
            detect1.On();


            var detect2 = MyScriptWrapper.GetDetector(MyScriptWrapper.GetEntity((uint)EntityID.detect2));
            detect2.OnEntityEnter += Detector2_Enter;
            detect2.On();


            MyScriptWrapper.ApplyTransition(MyMusicTransitionEnum.DesperateWithStress, 3); // Sets music group to be played in the sector - no matter if the mission is running or not

            MyScriptWrapper.Highlight((uint)EntityID.Cargo1, true, this); //highlighted items
            MyScriptWrapper.Highlight((uint)EntityID.Cargo2, true, this);
            MyScriptWrapper.Highlight((uint)EntityID.Cargo3, true, this);
            MyScriptWrapper.Highlight((uint)EntityID.Cargo4, true, this);

            MyScriptWrapper.OnDialogueFinished += new MyScriptWrapper.DialogueHandler(MyScriptWrapper_OnDialogueFinished);
        }
예제 #7
0
 private void GoToShipyardLoaded(MyMissionBase sender)
 {
     m_detectorShipyard = MyScriptWrapper.GetDetector(MyScriptWrapper.GetEntity((uint)EntityID.Detector_Shipyard));
     m_detectorShipyard.On();
     m_detectorShipyard.OnEntityEnter += ShipyardDetectorEntered;
 }
예제 #8
0
 private void M03FollowDirectionOnOnMissionLoaded(MyMissionBase sender)
 {
     m_followDirectionDetector = MyScriptWrapper.GetDetector((uint)EntityID.FollowDirectionDetector);
     m_followDirectionDetector.On();
     m_followDirectionDetector.OnEntityEnter += M03DetectorOnOnEntityEnter;
 }
        private void ProtectMadelyn_Loaded(MyMissionBase sender)
        {
            ActivateSpawnpoints(m_06SpawnPoints);

            m_06AttackDetector = MyScriptWrapper.GetDetector((uint)EntityID._06AttackmadelynDummy);
            m_06AttackDetector.On();
            m_06AttackDetector.OnEntityEnter += M06AttackDetectorOnOnEntityEnter;

            MyScriptWrapper.AddNotification(MyScriptWrapper.CreateNotification(MyTexts.ProtectSaphosCommandCenter, MyGuiManager.GetFontMinerWarsBlue(), 10000));

            ShowContainers(m_06BombsContainersIds);

            var index = 0;
            m_06BombsTrajectories = new List<MyLine>();
            m_06BombsContainers = new List<MyEntity>();
            m_06BombsDeath = new List<bool>();
            m_06BombsProgresses = new List<float>();
            m_06BombsMarked = new List<bool>();
            
            foreach (uint prefabId in m_06BombsPrefabsIDs)
            {
                m_06BombsTrajectories.Add(new MyLine(MyScriptWrapper.GetEntity(prefabId).GetPosition(), MyScriptWrapper.GetEntity(m_06BombsTargetDummy[index]).GetPosition()));
                m_06BombsContainers.Add(MyScriptWrapper.GetEntity(m_06BombsContainersIds[index]));
                m_06BombsProgresses.Add(-1);
                m_06BombsDeath.Add(false);
                m_06BombsMarked.Add(false);
                index++;
            }

            var madelyn = MyScriptWrapper.GetEntity("MadelynsBridge");
            MyScriptWrapper.MarkEntity(madelyn, sender.HudNameTemp.ToString(), MyHudIndicatorFlagsEnum.SHOW_DISTANCE | MyHudIndicatorFlagsEnum.SHOW_HEALTH_BARS | MyHudIndicatorFlagsEnum.SHOW_BORDER_INDICATORS | MyHudIndicatorFlagsEnum.SHOW_TEXT);
        }
예제 #10
0
 private void GetArmedLoaded(MyMissionBase sender)
 {
     m_detectorWeaponry = MyScriptWrapper.GetDetector(MyScriptWrapper.GetEntity((uint)EntityID.Detector_Weaponry));
     m_detectorWeaponry.On();
     m_detectorWeaponry.OnEntityEnter += WeaponryDetectorEntered;
 }
예제 #11
0
        public override void Load()
        {
            base.Load();

            MissionTimer.RegisterTimerAction(MyMwcUtils.GetRandomInt(3000, 5000), m_shakeAction, true);

            doorDetector1 = MyScriptWrapper.GetDetector(MyScriptWrapper.GetEntity(367));
            doorDetector1.OnEntityEnter += DoorDetector1Open;
            doorDetector1.On();

            doorDetector2 = MyScriptWrapper.GetDetector(MyScriptWrapper.GetEntity(366));
            doorDetector2.OnEntityEnter += DoorDetector2Closed;
            doorDetector2.On();
                        
            for (int i = 0; i < mines.GetLength(0); i++)
            {
                MyEntityDetector mineDetector = MyScriptWrapper.GetDetector(mines[i, 1]);
                mineDetector.OnEntityEnter += new OnEntityEnter(mineDetector_OnEntityEnter);
                mineDetector.OnEntityPositionChange += new OnEntityPositionChange(mineDetector_OnEntityPositionChange);
                mineDetector.On();
            }

            MyScriptWrapper.OnBotReachedWaypoint += OnBotReachedWaypoint;
            MyScriptWrapper.OnSpawnpointBotSpawned += OnSpawnpointBotSpawned;

            //aliendetector
            MyScriptWrapper.Highlight(RadarEntity, true,this);
            MyScriptWrapper.EnablePhysics(RadarEntity, false);

            //aliendetector
            MyScriptWrapper.Highlight(1962, true,this);
            MyScriptWrapper.EnablePhysics(1962, false);

        }
        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);
            }
        }
        public override void Load()
        {
            
            if (!IsMainSector) return;

            RemoveFriends();

            MyScriptWrapper.DisableAllGlobalEvents();

            m_attackerBots.Clear();

            m_detectorFirst = MyScriptWrapper.GetDetector((uint)EntityID.DetectorFirst);
            m_detectorSecond = MyScriptWrapper.GetDetector((uint)EntityID.DetectorSecond);
            m_detectorThird = MyScriptWrapper.GetDetector((uint)EntityID.DetectorThird);
            m_detectorFirst.SetSensorDetectRigidBodyTypes(null);
            m_detectorSecond.SetSensorDetectRigidBodyTypes(null);
            m_detectorThird.SetSensorDetectRigidBodyTypes(null);

            m_madelyn = MyScriptWrapper.GetEntity("Madelyn");
            //Because she was hidden in previous mission
            MyScriptWrapper.UnhideEntity(m_madelyn);
            m_transporter = MyScriptWrapper.GetEntity((uint)EntityID.Transporter);
            m_transporter.OnContactEvent += new Action<MyEntity>(m_transporter_OnContactEvent);
            m_reassignBotTargets = false;

            m_motherShipSpeed = MOTHERSHIP_FULLSPEED;

            MyScriptWrapper.PrepareMotherShipForMove(m_transporter);

            MyScriptWrapper.AddNotification(MyScriptWrapper.CreateNotification(Localization.MyTextsWrapperEnum.SwitchInHUBTurrets, MyGuiManager.GetFontMinerWarsGreen(), 60000, 
                new object[] {
                    MyGuiManager.GetInput().GetGameControlTextEnum(MyGameControlEnums.ROLL_LEFT),
                    MyGuiManager.GetInput().GetGameControlTextEnum(MyGameControlEnums.ROLL_RIGHT)
                }
            ));

            foreach (var item in m_spawnCompanions)
            {
                MyScriptWrapper.ActivateSpawnPoint(item);
            }
           
            var pos = MySession.PlayerShip.WorldMatrix.Translation;
            MySession.PlayerShip.WorldMatrix = m_transporter.WorldMatrix;
            Vector3 playerPos = m_transporter.WorldMatrix.Translation - 400 * m_transporter.WorldMatrix.Forward;
            MyScriptWrapper.Move(MySession.PlayerShip, playerPos);
            //MyScriptWrapper.EnablePhysics(MySession.PlayerShip.EntityId.Value.NumericValue, false);
            MyScriptWrapper.HideEntity(MySession.PlayerShip);

            m_towers[0] = MyScriptWrapper.GetEntity((uint)EntityID.Tower1);
            m_towers[1] = MyScriptWrapper.GetEntity((uint)EntityID.Tower2);
            m_towers[2] = MyScriptWrapper.GetEntity((uint)EntityID.Tower3);

            MyScriptWrapper.SetEntityPriority(m_towers[0], -1);
            MyScriptWrapper.SetEntityPriority(m_towers[1], -1);
            MyScriptWrapper.SetEntityPriority(m_towers[2], -1);
            MyScriptWrapper.SetEntityPriority(MyScriptWrapper.GetEntity((uint)EntityID.TowerDown), -1);

            MyScriptWrapper.TakeControlOfLargeWeapon(m_towers[m_activeTower]);
            MyScriptWrapper.ForbideDetaching();
            MyScriptWrapper.ApplyTransition(MyMusicTransitionEnum.Mystery);
            
            MyScriptWrapper.SwitchTowerPrevious += MyScriptWrapper_SwitchTowerPrevious;
            MyScriptWrapper.SwitchTowerNext += MyScriptWrapper_SwitchTowerNext;
            MyScriptWrapper.EntityDeath += MyScriptWrapper_OnEntityDeath;
            MyScriptWrapper.OnSpawnpointBotSpawned += BotSpawned;

            m_objective01_flyTowardsMadelyn.OnMissionLoaded += O01FlyTowardsMadelynLoaded;
            m_objective01_flyTowardsMadelyn.OnMissionSuccess += O01FlyTowardsMadelynSuccess;

            m_madelynDestinationReached = false;
            m_transporterDestinationReached = false;
            m_moveMadelynFlag = false;
           
            m_towersCount = 3;
            m_activeTower = 0;
            m_switchCounter = 0;

            MyScriptWrapper.DrawHealthOfCustomPrefabInLargeWeapon(MyScriptWrapper.GetEntity((uint)EntityID.TransporterShip));
            MyScriptWrapper.DisableShipBackCamera();
            m_detectorFirst.OnEntityEnter += DetectorActionFirst;
            m_detectorFirst.On();

            MyScriptWrapper.OnDialogueFinished += MyScriptWrapper_OnDialogueFinished;
            base.Load();
        }
예제 #14
0
        private void AssaultSubmissionLoaded(MyMissionBase sender)
        {
            m_commandDetector = MyScriptWrapper.GetDetector(MyScriptWrapper.GetEntity((uint)EntityID.Detector_Command));
            m_commandDetector.OnEntityEnter += CommandReached;
            m_commandDetector.On();

            MyScriptWrapper.HideEntity(MyScriptWrapper.GetEntity((uint)EntityID.ReichMothership));
        }
예제 #15
0
        void CreateDetectorForParticleEffect()
        {
            m_smallShipDetector = new MyEntityDetector();

            m_smallShipDetector.Init(
                null,
                new MyMwcObjectBuilder_EntityDetector(
                    new Vector3(MyDummyPointConstants.PARTICLE_DETECTOR_SIZE * UserScale, 0, 0),
                    MyMwcObjectBuilder_EntityDetector_TypesEnum.Sphere),
                this,
                WorldMatrix,
                new List<IMyEntityDetectorCriterium>());

            m_smallShipDetector.Save = false;
            m_smallShipDetector.SetSensorDetectRigidBodyTypes(MyConstants.RIGIDBODY_TYPE_SHIP);

            m_smallShipDetector.On();
        }
예제 #16
0
        private void UpdateBotToTalk()
        {

            m_success = false;

            if (m_constructorFromName)
            {
                MyMwcLog.WriteLine("Bot name: " + m_botName);
                m_botToTalk = (MySmallShipBot)MyScriptWrapper.GetEntity(m_botName);
                m_botToTalkId = m_botToTalk.EntityId.Value.NumericValue;
                MissionEntityIDs.Add(m_botToTalkId.Value);
            }
            else
            {
                MyMwcLog.WriteLine("Bot ID: " + m_botToTalkId.Value.ToString());
                MissionEntityIDs.Add(m_botToTalkId.Value);
                m_botToTalk = (MySmallShipBot)MyScriptWrapper.GetEntity(m_botToTalkId.Value);
            }

            m_detectorReached = false;
            Debug.Assert(m_botToTalk != null);

            if (m_botToTalk.WaypointPath != null)
            {
                PathName = m_botToTalk.WaypointPath.Name;
            }
            m_botToTalk.SpeedModifier = m_slowdown;

            if (m_botDetectorId.HasValue)
            {
                m_botDetector = MyScriptWrapper.GetDetector(m_botDetectorId.Value);
                m_botDetector.On();
                m_botDetector.OnEntityEnter += m_botDetector_OnEntityEnter;
            }
            else if (FollowMe)
            {
                MyScriptWrapper.Follow(MySession.PlayerShip, m_botToTalk);
            }
        }
예제 #17
0
        public override void Load()
        {
            m_emptyString = new StringBuilder();
            m_isFailed = false;
            if (BotLoaded != null)
            {
                foreach (var racerName in RacerNames)
                {
                    MySmallShipBot racer = (MySmallShipBot)MyScriptWrapper.GetEntity(racerName);
                    BotLoaded(racer);
                }
            }
            MyScriptWrapper.OnSpawnpointBotSpawned += MyScriptWrapper_OnSpawnpointBotSpawned;
            ResetStart();
            m_raceLocations = new List<MyMissionLocation>();
            foreach (uint u in m_checkpointsIDs)
            {
                MyMissionLocation loc = new MyMissionLocation(m_sector, u);
                MyEntity entity;
                MyEntities.TryGetEntityById(new MyEntityIdentifier(u), out entity);
                loc.Entity = entity;
                m_raceLocations.Add(loc);
            }


            m_isStartingGame = true;
            m_startingTime = 0;


            m_detector = MyScriptWrapper.GetDetector(m_detectorID);
            if (m_detector != null)
            {
                m_detector.OnEntityEnter += OnDetectorEnter;
                m_detector.OnEntityLeave += OnDetectorLeave;
                m_detector.On();
            }

            foreach (var myRacer in m_racers)
            {
                myRacer.Load();
            }

            m_currentCheckPointIndex = 0;
            m_restartRace = false;

            
            base.Load();
        }