Ejemplo n.º 1
0
        public override void Load()
        {
            base.Load();
            if (m_realMissionEntityId.HasValue)
                m_realMissionEntity = MyScriptWrapper.TryGetEntity(m_realMissionEntityId.Value);

            m_notification = new MyHudNotification.MyNotification(m_notificationText, MyHudConstants.MISSION_FONT, MyHudNotification.DONT_DISAPEAR, null, new object[] { "" });
            m_startingGeneratorProgressScreen_OnCanceledHandler = new EventHandler(OnCanceledHandler);
            m_startingGeneratorProgressScreen_OnSuccessHandler = new EventHandler(OnSuccessHandler);

            m_useProgress = new MyGuiScreenUseProgressBar(m_useCaption, m_useText, 0f, m_progressCue, m_cancelCue, MyGameControlEnums.USE, 0, m_requiredTime, 0);
            m_useProgress.OnCanceled += m_startingGeneratorProgressScreen_OnCanceledHandler;
            m_useProgress.OnSuccess += m_startingGeneratorProgressScreen_OnSuccessHandler;
        }
        public override void Load()
        {
            base.Load();
            m_entitiesToUse = new List<uint>();
            m_entitiesToUse.AddRange(MissionEntityIDs);
            InitSounds(m_objectiveType);
            m_totalCount = MissionEntityIDs.Count;
            m_notification = new MyHudNotification.MyNotification(m_notificationText, MyHudConstants.MISSION_FONT, MyHudNotification.DONT_DISAPEAR,null, new object[] { "" });
            m_startingGeneratorProgressScreen_OnCanceledHandler = new EventHandler(OnCanceledHandler);
            m_startingGeneratorProgressScreen_OnSuccessHandler = new EventHandler(OnSuccessHandler);

            m_useProgress = new MyGuiScreenUseProgressBar(m_useCaption, m_useText, 0f, m_progressCue, m_cancelCue, MyGameControlEnums.USE, 0, m_requiredTime, 0);
            m_useProgress.OnCanceled += m_startingGeneratorProgressScreen_OnCanceledHandler;
            m_useProgress.OnSuccess += m_startingGeneratorProgressScreen_OnSuccessHandler;


            foreach(var id in MissionEntityIDs)
            {
               SetLocationVisibility(true,MyScriptWrapper.GetEntity(id),MyGuitargetMode.Objective);
            }

            ReloadAdditionalHubInfo();
        }
        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);
            }
        }
Ejemplo n.º 4
0
        public override void Load()
        {
            
            MyScriptWrapper.OnBotReachedWaypoint += BotReachedWaypoint;
            MyScriptWrapper.OnSpawnpointBotSpawned += OnSpawnpointBotSpawned;
            MyScriptWrapper.EntityDeath += OnEntityDeath;

            m_actionKeyString[0] = MyGuiManager.GetInput().GetGameControlTextEnum(MyGameControlEnums.USE);
            
            m_canBuildNotification = MyScriptWrapper.CreateNotification(
                Localization.MyTextsWrapperEnum.PressToBuildTurret,
                MyGuiManager.GetFontMinerWarsBlue());
            m_canBuildNotification.SetTextFormatArguments(m_actionKeyString);

            m_remainingTurretsNotification = MyScriptWrapper.CreateNotification(
                Localization.MyTextsWrapperEnum.RemainingTurrets,
                MyGuiManager.GetFontMinerWarsBlue());

            //m_canSkipNotification = MyScriptWrapper.CreateNotification(
            //    Localization.MyTextsWrapperEnum.PressToSkipTimer,
            //    MyGuiManager.GetFontMinerWarsBlue());
            //m_canSkipNotification.SetTextFormatArguments(m_actionKeyString);
            //m_canSkipNotification.Disappear();

            m_generatorUnderAttackNotification = MyScriptWrapper.CreateNotification(
                Localization.MyTextsWrapperEnum.GeneratorUnderAttack,
                MyGuiManager.GetFontMinerWarsRed(), 3000);
            m_generatorUnderAttackNotification.Disappear();


            m_useProgress = new MyGuiScreenUseProgressBar(MyTextsWrapperEnum.Turrets, MyTextsWrapperEnum.BuildingInProgress,0f, MySoundCuesEnum.SfxProgressBuild, MySoundCuesEnum.SfxCancelBuild, MyGameControlEnums.USE, 0, 3000, 0);
            m_useProgress.OnCanceled += OnCanceledHandler;
            m_useProgress.OnSuccess += OnSuccessHandler;

            SetupMotherships();
            SetUpTurrets();

            base.Load();
        }
Ejemplo n.º 5
0
        private void StopHacking(MyHackingResultEnum result, HackingResultAction action = null, object[] parameters = null) 
        {                        
            MyHackingResultMessage resultMessage = m_hackingResultMessages[(int)result];
            if (resultMessage != null)
            {
                //MyGuiManager.AddScreen(new MyGuiScreenMessageBox(resultConfig.MessageBoxType, resultConfig.Text, MyTextsWrapperEnum.HackingResult, MyTextsWrapperEnum.Ok, null));
                resultMessage.Display(parameters);
            }

            if (m_hackingProgressScreen != null)
            {
                if (m_hackingProgressScreen.GetState() != MyGuiScreenState.CLOSED)
                {
                    m_hackingProgressScreen.CloseScreenNow();
                }
                m_hackingProgressScreen.OnCanceled -= m_hackingProgressScreenCanceled;
                m_hackingProgressScreen.OnSuccess -= m_hackingProgressScreenSuccess;
                m_hackingProgressScreen = null;
            }
            m_owner.OnDie -= m_ownerDie;
            if (action != null) 
            {
                action();
            }
            NotifyHackingFinish(result);
            m_acutalHackingEntity = null;
            //m_hackingTimeLeft = 0;
            m_state = MyHackingToolStateEnum.Idle;
        }
Ejemplo n.º 6
0
        public void Hack(IMyUseableEntity entityToHack) 
        {
            if (entityToHack == null) 
            {
                throw new ArgumentNullException("entityToHack");
            }
            if (!entityToHack.CanBeHacked(m_owner)) 
            {
                StopHacking(MyHackingResultEnum.CanNotBeHacked);
                return;
            }
            if (HackingLevel < 1) 
            {
                StopHacking(MyHackingResultEnum.NoHackingTool);
                return;
            }
            if (entityToHack.UseProperties.HackingLevel > HackingLevel) 
            {
                StopHacking(MyHackingResultEnum.NotEnoughLevel, null, new object[]{ entityToHack.UseProperties.HackingLevel, HackingLevel });
                return;
            }

            m_state = MyHackingToolStateEnum.Hacking;
            m_acutalHackingEntity = entityToHack;
            //m_hackingTimeTotal = (int)((float)entityToHack.UseProperties.HackingTime * (1f - (HackingLevel - entityToHack.UseProperties.HackingLevel) * 0.25f));
            //m_hackingTimeLeft = m_hackingTimeTotal;
            NotifyHackingStart();
            int hackingTimeTotal = (int)((float)entityToHack.UseProperties.HackingTime * (1f - (HackingLevel - entityToHack.UseProperties.HackingLevel) * 0.25f));
            m_hackingProgressScreen = new MyGuiScreenUseProgressBar(MyTextsWrapperEnum.Hacking, MyTextsWrapperEnum.HackingProgress, 0f, MySoundCuesEnum.SfxProgressHack, MySoundCuesEnum.SfxCancelHack, MyGameControlEnums.USE, 50, hackingTimeTotal, 0);
            m_hackingProgressScreen.OnCanceled += m_hackingProgressScreenCanceled;
            m_hackingProgressScreen.OnSuccess += m_hackingProgressScreenSuccess;
            m_owner.OnDie += m_ownerDie;
            MyGuiManager.AddScreen(m_hackingProgressScreen);
        }