public static void RegisterSlowDetectorForUpdate(MyEntityDetector detector)
        {
            m_slowDetectors.Add(detector);
            detector.UpdateCounter = GlobalSlowDetectorCounter++;

            UpdateEntitiesPerFrame();
        }
        public static void UnregisterSlowDetectorForUpdate(MyEntityDetector detector)
        {
            m_slowDetectors.Remove(detector);
            m_currentDetectorIndex = 0;

            UpdateEntitiesPerFrame();
        }
Ejemplo n.º 3
0
        public static void UnregisterSlowDetectorForUpdate(MyEntityDetector detector)
        {
            m_slowDetectors.Remove(detector);
            m_currentDetectorIndex = 0;

            UpdateEntitiesPerFrame();
        }
Ejemplo n.º 4
0
        public static void RegisterSlowDetectorForUpdate(MyEntityDetector detector)
        {
            m_slowDetectors.Add(detector);
            detector.UpdateCounter = GlobalSlowDetectorCounter++;

            UpdateEntitiesPerFrame();
        }
Ejemplo n.º 5
0
        private void mineDetector_OnEntityPositionChange(MyEntityDetector sender, MyEntity entity, Vector3 newposition)
        {
            if (sender.Closed)
                return;

            if (entity == MySession.PlayerShip)
            {
                if (m_beepCue == null || !m_beepCue.Value.IsPlaying)
                {
                    m_beepCue = MyAudio.AddCue2D(MySoundCuesEnum.SfxHudAlarmDamageA);
                }

                float distance = (entity.GetPosition() - sender.GetPosition()).Length();

                if (distance < m_mineStartRadius)
                {
                    uint mineId = 0;
                    for (int i = 0; i < m_mines.GetLength(0); i++)
                    {
                        if (m_mines[i, 1] == sender.Parent.EntityId.Value.NumericValue)
                        {
                            mineId = m_mines[i, 0];
                        }
                    }
                    ExplodeMine(mineId);
                    sender.Off();
                    sender.Parent.MarkForClose();
                }

            }
        }
        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);


        }
Ejemplo n.º 7
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 static bool CanBeSlowDetectorUpdated(MyEntityDetector detector)
        {
            Debug.Assert(m_slowDetectors.Count > m_currentDetectorIndex);
            int index = detector.UpdateCounter % m_slowDetectors.Count;
            if (index >= m_currentDetectorIndex && index < m_currentDetectorIndex + m_entitiesPerFrameToUpdate)
                return true;

            return false;
        }
Ejemplo n.º 9
0
        public static bool CanBeSlowDetectorUpdated(MyEntityDetector detector)
        {
            Debug.Assert(m_slowDetectors.Count > m_currentDetectorIndex);
            int index = detector.UpdateCounter % m_slowDetectors.Count;

            if (index >= m_currentDetectorIndex && index < m_currentDetectorIndex + m_entitiesPerFrameToUpdate)
            {
                return(true);
            }

            return(false);
        }
Ejemplo n.º 10
0
        private void DetectorOnOnEntityEnter(MyEntityDetector sender, MyEntity entity, int meetCriterias)
        {
            var isEnteredWithDrone = MyGuiScreenGamePlay.Static.IsControlledDrone &&
                                    entity == MyGuiScreenGamePlay.Static.ControlledDrone;

            if(MyScriptWrapper.IsPlayerShip(entity) || isEnteredWithDrone)
            {
                m_detector.Off();
                MyScriptWrapper.PlayDialogue(m_dialogueId);
                if (OnDialogStarted != null) OnDialogStarted();
            }
        }
Ejemplo n.º 11
0
        void OnDetector(MyEntityDetector sender, MyEntity entity, int meetCriterias)
        {
            if (entity != null && entity == MinerWars.AppCode.Game.Managers.Session.MySession.PlayerShip)
            {
                MyScriptWrapper.OnSpawnpointBotSpawned += OnSpawnpointBotSpawned;
                MyScriptWrapper.EntityDeath += EntityDeath;

                SpawnNewWave(0);

                m_detector.OnEntityEnter -= OnDetector;
            }
        }
 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);                
 }
Ejemplo n.º 13
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>();
        }
Ejemplo n.º 14
0
 private void DialogueBase(MyEntityDetector sender, MyEntity entity, int meetCriterias)
 {
     if (entity == MySession.PlayerShip)
     {
         MyScriptWrapper.PlayDialogue(Audio.Dialogues.MyDialogueEnum.RIFT_0200_STATION);
         MissionTimer.RegisterTimerAction(24000, DialogueBaseCont, false);
         sender.Off();
     }
 }
Ejemplo n.º 15
0
        private void RiftLeft(MyEntityDetector sender, MyEntity entity)
        {
            if (entity == MySession.PlayerShip)
            {
                // stop shakes
                m_riftShake = false;

                MyScriptWrapper.PlayDialogue(Audio.Dialogues.MyDialogueEnum.RIFT_1100_LEAVING);
            }
        }
Ejemplo n.º 16
0
        private void RiftReached(MyEntityDetector sender, MyEntity entity, int meetCriterias)
        {
            if (entity == MySession.PlayerShip)
            {
                //MyAudio.ApplyTransition(MyMusicTransitionEnum.Mystery);

                // start shakes
                m_riftShake = true;
                MissionTimer.RegisterTimerAction(MyMwcUtils.GetRandomInt(4000, 12000), m_farExplosionAction, false);
            }
        }
Ejemplo n.º 17
0
        public override void Unload()
        {
            MyScriptWrapper.OnSpawnpointBotSpawned -= MyScriptWrapperOnOnSpawnpointBotSpawned;
            MyScriptWrapper.OnSentenceStarted -= MyScriptWrapper_OnSentenceStarted;

            m_madelyn = null;
            m_followCoordinatesDetector = null;
            HideDrawCampaignEnd();

            base.Unload();
        }
 void DummyNearVolodia_Enter(MyEntityDetector sender, MyEntity entity, int meetCriterias)
 {
     if (MyScriptWrapper.IsPlayerShip(entity))
     {
         MyScriptWrapper.PlayDialogue(MyDialogueEnum.RUSSIAN_TRANSMITTER_0700_STRANGERPROPOSAL);
         sender.Off();
     }
 }
Ejemplo n.º 19
0
 public void Detector3Action(MyEntityDetector sender, MyEntity entity, int meetCriterias)
 {
     if (MySession.IsPlayerShip(entity))
     {
         MyScriptWrapper.ActivateSpawnPoint((uint)EntityID.Spawn3);
         m_Detector3.Off();
     }
 }
Ejemplo n.º 20
0
 private void M03DetectorOnOnEntityEnter(MyEntityDetector sender, MyEntity entity, int meetCriterias)
 {
     if (entity == MySession.PlayerShip)
     {
         var madelynLocation = MyScriptWrapper.GetEntity((uint)EntityID.RunForYourLifeMovingMadelyn);
         MyScriptWrapper.Move(m_madelyn, madelynLocation.GetPosition(), madelynLocation.GetForward(), madelynLocation.GetUp());
         sender.Off();
     }
 }
Ejemplo n.º 21
0
 private void M11BDetectorOnOnEntityEnter(MyEntityDetector sender, MyEntity entity, int meetCriterias)
 {
     MyScriptWrapper.SetEntitiesEnabled(m_boardSecondShipbparticlesDisable, false);
     MyScriptWrapper.SetEntitiesEnabled(m_boardSecondShipbparticlesEnable, true);
     MyScriptWrapper.ActivateSpawnPoint((uint)EntityID.BoardSecondShipbSpawn0);
 }
        private void EscapeEvent(MyEntityDetector sender, MyEntity entity, int meetcriterias)
        {
            if (MyMissions.ActiveMission != null && MyMissions.ActiveMission.ActiveObjectives != null && MyMissions.ActiveMission.ActiveObjectives.Contains(m_escape))
            {
                MyScriptWrapper.AddExplosions(new List<uint>() { (uint)EntityID.EscapeEventDummyToActive1, (uint)EntityID.EscapeEventDummyToActive2 }, Explosions.MyExplosionTypeEnum.LARGE_SHIP_EXPLOSION, 100);

                MyScriptWrapper.SetEntityEnabled(MyScriptWrapper.GetEntity((uint)EntityID.ParticleDummy1), false);
                MyScriptWrapper.SetEntityEnabled(MyScriptWrapper.GetEntity((uint)EntityID.ParticleDummy2), false);
                ShowContainer(EntityID.InvisibleContainer3);
                MyScriptWrapper.AddVoxelHand((uint)EntityID.VoxelMap, 2203550, 100, MyMwcVoxelMaterialsEnum.Stone_03, MyMwcVoxelHandModeTypeEnum.SUBTRACT);
                MyScriptWrapper.AddVoxelHand((uint)EntityID.VoxelMap, 2203550, 61, MyMwcVoxelMaterialsEnum.Stone_03, MyMwcVoxelHandModeTypeEnum.SUBTRACT);
                MyScriptWrapper.ActivateSpawnPoint((uint)EntityID.SpawnPointEscape);

                this.Components.Add(new MyHeadshake(MissionTimer.ElapsedTime, MyHeadshake.DefaultShaking, 12, 5, 10));
            }

        }
Ejemplo n.º 23
0
 private void GetArmedLoaded(MyMissionBase sender)
 {
     m_detectorWeaponry = MyScriptWrapper.GetDetector(MyScriptWrapper.GetEntity((uint)EntityID.Detector_Weaponry));
     m_detectorWeaponry.On();
     m_detectorWeaponry.OnEntityEnter += WeaponryDetectorEntered;
 }
 void MyRussianTransmitterMission_OnEntityEnter(MyEntityDetector sender, MyEntity entity, int meetCriterias)
 {
     if (MyScriptWrapper.IsPlayerShip(entity))
     {
         MyScriptWrapper.PlayDialogue(MyDialogueEnum.RUSSIAN_TRANSMITTER_0200_BACKDOOR);
         sender.Off();
     }
 }
 void DummyNearFrequencyHub_Enter(MyEntityDetector sender, MyEntity entity, int meetCriterias)
 {
     if (MyScriptWrapper.IsPlayerShip(entity))
     {
         if (m_tradeWithVolodia.IsCompleted())
         {
             MyScriptWrapper.PlayDialogue(MyDialogueEnum.RUSSIAN_TRANSMITTER_1500_IFITDOESNOTWORK);
             sender.Off();
         }
         else
         {
             MyScriptWrapper.PlayDialogue(MyDialogueEnum.RUSSIAN_TRANSMITTER_0400_HUBFOUND);
             sender.Off();
         }
     }
 }
Ejemplo n.º 26
0
 private void DialogueMining(MyEntityDetector sender, MyEntity entity, int meetCriterias)
 {
     if (entity == MySession.PlayerShip)
     {
         MyScriptWrapper.PlayDialogue(Audio.Dialogues.MyDialogueEnum.RIFT_0600_MINING);
         MyScriptWrapper.EntityInventoryItemAmountChanged += OreAmountChanged;
         sender.Off();
     }
 }
Ejemplo n.º 27
0
 private void M03FollowDirectionOnOnMissionLoaded(MyMissionBase sender)
 {
     m_followDirectionDetector = MyScriptWrapper.GetDetector((uint)EntityID.FollowDirectionDetector);
     m_followDirectionDetector.On();
     m_followDirectionDetector.OnEntityEnter += M03DetectorOnOnEntityEnter;
 }
Ejemplo n.º 28
0
 private void Erupt(MyEntityDetector sender, MyEntity entity, int meetCriterias)
 {
     if (entity == MySession.PlayerShip)
     {
         MyScriptWrapper.AddExplosion(sender, MyExplosionTypeEnum.BOMB_EXPLOSION, MyMwcUtils.GetRandomFloat(40f, 60f), MyMwcUtils.GetRandomFloat(25f, 40f), true);
         MyScriptWrapper.IncreaseHeadShake(MyMwcUtils.GetRandomFloat(5f, 15f));
         sender.Off();
     }
 }
Ejemplo n.º 29
0
 private void M01DetectorOnOnEntityEnter(MyEntityDetector sender, MyEntity entity, int meetCriterias)
 {
     //if(entity==MySession.PlayerShip)
     //  MyScriptWrapper.ActivateSpawnPoint((uint)EntityID.FollowCoordinatesSpawnPoint);
 }
Ejemplo n.º 30
0
        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();

        }
Ejemplo n.º 31
0
        public override void Load() // Code in that block will be called on the load of the sector
        {
            m_followCoordinatesDetector = MyScriptWrapper.GetDetector((uint)EntityID.FollowCoordinatesDummy);
            m_madelyn = MyScriptWrapper.GetEntity(MyActorConstants.GetActorName(MyActorEnum.MADELYN));  

            base.Load();

            MyScriptWrapper.OnSpawnpointBotSpawned += MyScriptWrapperOnOnSpawnpointBotSpawned;
            MyScriptWrapper.OnSentenceStarted += MyScriptWrapper_OnSentenceStarted;

            if (MyScriptWrapper.IsMissionFinished(MyMissionID.ALIEN_GATE_COUGHT_IN_TRAP))
            {
                MyScriptWrapper.ApplyTransition(MyMusicTransitionEnum.CalmAtmosphere);
            }
            else
            {
                MyScriptWrapper.ApplyTransition(MyMusicTransitionEnum.Horror, 100, "KA02");
            }

            MyScriptWrapper.TryHide((uint)EntityID.Voxel1);
            MyScriptWrapper.TryHide((uint)EntityID.Voxel2);
            MyScriptWrapper.TryHide((uint)EntityID.Voxel3);
            MyScriptWrapper.SetFactionRelation(MyMwcObjectBuilder_FactionEnum.Rainiers, MyMwcObjectBuilder_FactionEnum.Russian_KGB, MyFactions.RELATION_NEUTRAL);

            if (MyScriptWrapper.IsMissionFinished(MyMissionID.ALIEN_GATE_FOLLOW_DIRECTION)) 
            {
                MyScriptWrapper.SetFactionRelation(MyMwcObjectBuilder_FactionEnum.Russian_KGB, MyMwcObjectBuilder_FactionEnum.Rainiers, MyFactions.RELATION_WORST);
            }
        }
Ejemplo n.º 32
0
 private void GoToShipyardLoaded(MyMissionBase sender)
 {
     m_detectorShipyard = MyScriptWrapper.GetDetector(MyScriptWrapper.GetEntity((uint)EntityID.Detector_Shipyard));
     m_detectorShipyard.On();
     m_detectorShipyard.OnEntityEnter += ShipyardDetectorEntered;
 }
 void DummyNearCargo_Enter(MyEntityDetector sender, MyEntity entity, int meetCriterias)
 {
     if (MyScriptWrapper.IsPlayerShip(entity))
     {
         MyScriptWrapper.PlayDialogue(MyDialogueEnum.RUSSIAN_TRANSMITTER_0800_NEARCARGO);
         sender.Off();
     }
 }