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