Exemplo n.º 1
0
 private void updateScore()
 {
     // TODO: figure out active player num for when more than one player
     timerText.text  = "Time Remaining: " + FareTools.roundTwoDecimals(MissionTimer.TimeRemaining());
     playerText.text = "Player 1";
     scoresText.text = "";
     for (int i = 0; i < players.Length; i++)
     {
         FarePlayerController fpc = players [i].playerCustomer.farePlayerController;
         scoresText.text += "Player " + (i + 1) + ": $" + fpc.money;
         if (null != fpc.fare)
         {
             scoresText.text += " Charge: $" + fpc.charge + "\n";
         }
         else
         {
             if (i == 0)
             {
                 fareText.text = "";
             }
             scoresText.text += "\n";
         }
         if (i == 0 && null != fpc.fareResponse)
         {
             fareText.text += " \"" + fpc.fareResponse.verbal + "\"";
         }
     }
 }
        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);
        }
Exemplo n.º 3
0
        void autodestructDestroy_OnMissionSuccess(MyMissionBase sender)
        {
            MyScriptWrapper.SetAlarmMode((uint)EntityID.AlarmAutodestruct1, false);
            MyScriptWrapper.SetAlarmMode((uint)EntityID.AlarmAutodestruct2, false);

            MissionTimer.ClearActions();
        }
Exemplo n.º 4
0
        private void MeteorAction()
        {
            MyScriptWrapper.EnableGlobalEvent(World.Global.MyGlobalEventEnum.MeteorWind, true);
            MissionTimer.RegisterTimerAction(MyMwcUtils.GetRandomInt(2000, 4000), MeteorAction, false);

            //MyScriptWrapper.GenerateMeteor(100, MySession.PlayerShip.GetPosition() + MySession.PlayerShip.WorldMatrix.Forward * 500, MyMwcVoxelMaterialsEnum.Lava_01, MySession.PlayerShip.WorldMatrix.Forward * -1000, MyParticleEffectsIDEnum.MeteorTrail_FireAndSmoke);
        }
Exemplo n.º 5
0
 public void SkipTimer()
 {
     MissionTimer.SetElapsedTime(SubmissionDuration);
     //SubmissionDuration = MissionTimer.GetElapsedTime();
     m_countdownNotification.Disappear();
     SendTimer(true, false);
 }
 void AsteroidInsideExplosion4()
 {
     MyScriptWrapper.AddExplosion(MyScriptWrapper.GetEntity((uint)EntityID.ExplosionIn4_1), MyExplosionTypeEnum.BOMB_EXPLOSION, 100f, 500f);
     MyScriptWrapper.AddExplosion(MyScriptWrapper.GetEntity((uint)EntityID.ExplosionIn4_2), MyExplosionTypeEnum.BOMB_EXPLOSION, 100f, 500f);
     MyScriptWrapper.SetParticleEffect(MyScriptWrapper.GetEntity((uint)EntityID.ExplosionLarge2), true);
     MyScriptWrapper.PlaySound3D(MySession.PlayerShip, MySoundCuesEnum.SfxShipLargeExplosion);
     MissionTimer.RegisterTimerAction(1000, AsteroidInsideExplosion4_2, false);
 }
Exemplo n.º 7
0
 private void ResetAll()
 {
     MissionTimer.ResetTimer();
     for (int i = 0; i < players.Length; i++)
     {
         players[i].Reset();
     }
 }
Exemplo n.º 8
0
 void Accelerate()
 {
     if (m_moveMS_AccelerateCounter < 150)
     {
         m_moveMS_Speed += 28f;
         MissionTimer.RegisterTimerAction(250, Accelerate, false);
     }
 }
Exemplo n.º 9
0
        public override void OnMissionScreenInitialize()
        {
            base.OnMissionScreenInitialize();

            _layer = new GauntletLayer(20);
            _layer.LoadMovie(nameof(BattleMiniMapView), _dataSource);
            MissionScreen.AddLayer(_layer);
            _timer = new MissionTimer(0.05f);
        }
Exemplo n.º 10
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();
     }
 }
        private void MyScriptWrapperOnOnDialogueFinished(MyDialogueEnum dialogue, bool interrupted)
        {
            switch (dialogue)
            {
            case MyDialogueEnum.EAC_AMBUSH_0300_GUYS_HURRY_UP:
                MyScriptWrapper.PlayDialogue(MyDialogueEnum.EAC_AMBUSH_0400_MARCUS_TO_EAC);
                break;

            case MyDialogueEnum.EAC_AMBUSH_0400_MARCUS_TO_EAC:
                if (m_backToMadelyn.IsAvailable())
                {
                    m_backToMadelyn.Success();
                }
                if (m_speakWithPolice.IsAvailable())
                {
                    m_speakWithPolice.Success();
                }
                MyScriptWrapper.ActivateSpawnPoints(m_barricadeSpawns);
                m_speakWithPoliceDialogueFinished = true;
                break;

            case MyDialogueEnum.EAC_AMBUSH_1200_1300:
                MyScriptWrapper.HideEntity(m_ravenGirl);
                MyScriptWrapper.RemoveEntityMark(m_ravenGirl);

                MyScriptWrapper.SetEntitiesEnabled(m_particlesMarcus, false);

                m_marcus.AITemplate = MyBotAITemplates.GetTemplate(MyAITemplateEnum.PASSIVE);
                m_marcus.SetWaypointPath("MarcusRetreat");
                m_marcus.PatrolMode = MyPatrolMode.ONE_WAY;
                m_marcus.Patrol();

                m_ravenGuy.AITemplate = MyBotAITemplates.GetTemplate(MyAITemplateEnum.PASSIVE);
                m_ravenGuy.SetWaypointPath("VitolinoRetreat");
                m_ravenGuy.PatrolMode = MyPatrolMode.ONE_WAY;
                m_ravenGuy.Patrol();

                MyScriptWrapper.PlayDialogue(MyDialogueEnum.EAC_AMBUSH_1500);
                MissionTimer.RegisterTimerAction(30000, MarcusForCrashDialogue, false);
                break;

            case MyDialogueEnum.EAC_AMBUSH_1500:
                //MyScriptWrapper.ApplyTransition(MyMusicTransitionEnum.Special, 3, "LostInTheDistance");
                break;

            case MyDialogueEnum.EAC_AMBUSH_1600:
                //MyScriptWrapper.ApplyTransition(MyMusicTransitionEnum.SadnessOrDesperation, 3, "KA02"); //TODO: change to
                MyScriptWrapper.PlayDialogue(MyDialogueEnum.EAC_AMBUSH_1650);
                MarcusForCrash();
                break;

            case MyDialogueEnum.EAC_AMBUSH_1650:
                Boom();
                break;
            }
        }
Exemplo n.º 12
0
 void O05GetCloserToEnemyLoaded(MyMissionBase sender)
 {
     MyScriptWrapper.StopTransition(3);
     MyScriptWrapper.ApplyTransition(MyMusicTransitionEnum.DesperateWithStress, 1, "KA01");
     //smuggler.SetWaypointPath("SmugglerRun2");
     m_manjeet.PatrolMode = MyPatrolMode.ONE_WAY;
     m_manjeet.Patrol();
     m_manjeet.LookTarget = null;
     MissionTimer.RegisterTimerAction(10000, StartPathDialogue, false);
 }
 private void M08DestroyOnMissionSuccess(MyMissionBase sender)
 {
     MyScriptWrapper.PlayDialogue(MyDialogueEnum.WHITEWOLVES_RESEARCH_0600_DESTROY);
     Boom1();
     MissionTimer.RegisterTimerAction(250, Boom1Hide, false);
     MissionTimer.RegisterTimerAction(1000, Boom2, false);
     MissionTimer.RegisterTimerAction(1250, Boom2Hide, false);
     MissionTimer.RegisterTimerAction(2020, Boom3, false);
     MissionTimer.RegisterTimerAction(2450, Boom3Hide, false);
 }
 void O01FlyTowardsMadelynSuccess(MyMissionBase sender)
 {
     MyScriptWrapper.ApplyTransition(MyMusicTransitionEnum.HeavyFight, 3, "KA03");
     MyScriptWrapper.ActivateSpawnPoint((uint)EntityID.SpawnLastAsteroid);
     MyScriptWrapper.PlayDialogue(MyDialogueEnum.CHINESE_ESCAPE_0900_KILL_THOSE_BASTARDS);
     MissionTimer.RegisterTimerAction(15000, ExplosionLastAsteroid1, false);
     MyScriptWrapper.SetParticleEffect(MyScriptWrapper.GetEntity((uint)EntityID.ExplosionParticleLeft1), true);
     MyScriptWrapper.PlaySound3D(MySession.PlayerShip, MySoundCuesEnum.SfxShipLargeExplosion);
     MyScriptWrapper.ActivateSpawnPoint((uint)EntityID.SpawnLastL);
     MyScriptWrapper.ActivateSpawnPoint((uint)EntityID.SpawnLastR);
 }
Exemplo n.º 15
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);
            }
        }
    public void AddMission(string nameMission)
    {
        GameObject go = Instantiate(missionTimer);

        go.transform.SetParent(blockMission);
        go.transform.localScale = new Vector3(1, 1, 1);
        MissionTimer timer = go.GetComponent <MissionTimer>();

        timer.textName.text  = nameMission;
        timer.textValue.text = "---";
        listMissionTimer.Add(nameMission, timer);
    }
Exemplo n.º 17
0
    private void Start()
    {
        pickupMovementPath.duration = pickupPathDuration;
        numberOfDestroyedBarrels    = maximumBarrelsToDestroy;



        missionTimer = new MissionTimer();
        missionTimer.Reset(missionDuration);


        EnableSniperCanvas(false);
    }
Exemplo n.º 18
0
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
         DontDestroyOnLoad(gameObject);
         SetupTimer();
     }
     else if (instance != this)
     {
         Debug.Log("Destroying extra MissionTimer instance.");
         Destroy(gameObject);
     }
 }
Exemplo n.º 19
0
    private IEnumerator MissionStarting()
    {
        ResetAll();
        DisablePlayerControl();

        cameraControl.SetStartPositionAndSize();

        missionNumber++;
        messageText.text = "MISSION " + missionNumber;
        MissionTimer.StartCountdown();
        updateScore();

        yield return(startWait);
    }
Exemplo n.º 20
0
    private void OnEnable()
    {
        _timer = FindObjectOfType <MissionTimer>();
        if (_timer != null)
        {
            _timer.StartTimer(timeLimitInSeconds);
            _timer.Expired += MissionTimeIsUp;
        }

        _escape = FindObjectOfType <Escape>();
        _escape.PlayerEscaped += EscapeFromMission;

        _worryHub = gameObject.FindOrCreate <WorryHub>();
        _worryHub.WorryOverhead += PlayerCaught;
    }
Exemplo n.º 21
0
        private void FarExplosion()
        {
            // MainShake
            MyScriptWrapper.IncreaseHeadShake(MyMwcUtils.GetRandomInt(7, 10));
            MyScriptWrapper.AddAudioImpShipQuake();

            // Register sub shakes
            MissionTimer.RegisterTimerAction(MyMwcUtils.GetRandomInt(200, 400), m_subShakeAction, false);
            MissionTimer.RegisterTimerAction(MyMwcUtils.GetRandomInt(600, 800), m_subShakeAction, false);
            MissionTimer.RegisterTimerAction(MyMwcUtils.GetRandomInt(800, 1200), m_subShakeAction, false);
            MissionTimer.RegisterTimerAction(MyMwcUtils.GetRandomInt(1200, 1400), m_subShakeAction, false);

            // Register next far explosion
            MissionTimer.RegisterTimerAction(MyMwcUtils.GetRandomInt(3000, 5000), m_shakeAction, false);
            //TODO add particle effect
        }
Exemplo n.º 22
0
 private void OnDetectorEnter(MyEntityDetector sender, MyEntity entity, int meetcriterias)
 {
     if (m_restartRace)
     {
         MyScriptWrapper.RemoveEntityMark(m_detector);
         ResetStart();
         m_restartRace = false;
         Name          = m_prepareName;
     }
     else //only first time
     {
         MyScriptWrapper.PlaySound3D(sender, MySoundCuesEnum.VocRace01Welcome);
         m_startSoundFinished = false;
         MissionTimer.RegisterTimerAction(14000, () => { m_startSoundFinished = true; });
     }
 }
        //private void AssignTargetsToBots()
        //{
        //    foreach (var spawn in m_spawnCompanions)
        //    {
        //        MyScriptWrapper.GetEntity(spawn).Faction = MyMwcObjectBuilder_FactionEnum.China;
        //        foreach (var bot in MyScriptWrapper.GetSpawnPointBots(spawn))
        //        {
        //            if (bot.Ship != null)
        //            {
        //                bot.Ship.Attack(MyScriptWrapper.GetEntity((uint)m_transporterAttackPoints[MyMwcUtils.GetRandomInt(m_transporterAttackPoints.Count)]));
        //            }
        //        }
        //    }

        //    if (m_reassignBotTargets)
        //    {
        //        MissionTimer.RegisterTimerAction(3000, AssignTargetsToBots, false);
        //    }
        //}

        private void DetectorActionSecond(MyEntityDetector sender, MyEntity entity, int meetCriterias)
        {
            if (entity == m_transporter)
            {
                MissionTimer.RegisterTimerAction(8000, AsteroidInsideExplosionR2, false);
                MissionTimer.RegisterTimerAction(12000, AsteroidInsideExplosionL1, false);
                MissionTimer.RegisterTimerAction(20000, WatchFront, false);
                MissionTimer.RegisterTimerAction(15000, AsteroidInsideExplosion3, false);
                MissionTimer.RegisterTimerAction(18000, AsteroidInsideExplosion4, false);
                MyScriptWrapper.AddExplosion(MyScriptWrapper.GetEntity((uint)EntityID.ExplosionRight1_1), MyExplosionTypeEnum.BOMB_EXPLOSION, 100f, 500f);
                m_detectorSecond.Off();
                m_detectorSecond.OnEntityEnter -= DetectorActionSecond;
                m_detectorThird.OnEntityEnter  += DetectorActionThird;
                m_detectorThird.On();
            }
        }
Exemplo n.º 24
0
        bool CheckConditions(MissionTrigger tr)
        {
            bool cndSatisfied = true;

            foreach (var cnd in tr.Conditions)
            {
                if (cnd.Type == TriggerConditions.Cnd_True ||
                    cnd.Type == TriggerConditions.Cnd_SpaceEnter ||
                    cnd.Type == TriggerConditions.Cnd_BaseEnter ||
                    cnd.Type == TriggerConditions.Cnd_SpaceExit)
                {
                    cndSatisfied = true;
                }
                else if (cnd.Type == TriggerConditions.Cnd_CommComplete)
                {
                    if (finishedLines.Contains(cnd.Entry[0].ToString()))
                    {
                        cndSatisfied = true;
                    }
                    else
                    {
                        cndSatisfied = false;
                        break;
                    }
                }
                else if (cnd.Type == TriggerConditions.Cnd_Timer)
                {
                    MissionTimer t;
                    if (!timers.TryGetValue(tr.Nickname, out t))
                    {
                        t = new MissionTimer();
                        timers.Add(tr.Nickname, t);
                    }
                    if (t.T < cnd.Entry[0].ToSingle())
                    {
                        cndSatisfied = false;
                        break;
                    }
                }
                else
                {
                    cndSatisfied = false;
                    break;
                }
            }
            return(cndSatisfied);
        }
        private void Boom()
        {
            StartMovingMadelyn2();
            MyScriptWrapper.HideEntity(m_marcus);
            MyScriptWrapper.RemoveEntityMark(m_marcus);
            MyScriptWrapper.PlayDialogue(MyDialogueEnum.EAC_AMBUSH_1700);
            MyScriptWrapper.DeactivateSpawnPoints(m_wavesMarcusSpawns);

            MyScriptWrapper.AddExplosions(m_particlesExplosion1, Explosions.MyExplosionTypeEnum.LARGE_SHIP_EXPLOSION, 100, particleIDOverride: MyParticleEffectsIDEnum.Explosion_Medium);

            MissionTimer.RegisterTimerAction(3000, Boom1, false);
            MissionTimer.RegisterTimerAction(4000, Boom2, false);
            MissionTimer.RegisterTimerAction(4500, Boom2_2, false);
            MissionTimer.RegisterTimerAction(5000, Boom3, false);
            MissionTimer.RegisterTimerAction(5500, Boom4, false);
            MissionTimer.RegisterTimerAction(7000, Boom4_2, false);
            MissionTimer.RegisterTimerAction(30000, EndGame, false);
        }
        private void DetectorActionThird(MyEntityDetector sender, MyEntity entity, int meetCriterias)
        {
            MyScriptWrapper.SetParticleEffect(MyScriptWrapper.GetEntity((uint)EntityID.ExplosionLarge3), true);
            MyScriptWrapper.PlaySound3D(MySession.PlayerShip, MySoundCuesEnum.SfxShipLargeExplosion);
            if (entity == m_transporter)
            {
                m_moveMadelynFlag = true;
                MyScriptWrapper.SetParticleEffect(MyScriptWrapper.GetEntity((uint)EntityID.ExplosionParticleFirstRight), true);
                MyScriptWrapper.PlaySound3D(MySession.PlayerShip, MySoundCuesEnum.SfxShipLargeExplosion);
                MyScriptWrapper.ActivateSpawnPoint((uint)EntityID.SpawnCenterL);
                MyScriptWrapper.ActivateSpawnPoint((uint)EntityID.SpawnCenterR);
                MyScriptWrapper.PlayDialogue(MyDialogueEnum.CHINESE_ESCAPE_0700_ON_THE_RIGHT);

                MissionTimer.RegisterTimerAction(20000, Last1, false);
                m_detectorThird.Off();
                m_detectorThird.OnEntityEnter -= DetectorActionThird;
            }
        }
Exemplo n.º 27
0
        void autodestructEscape_OnMissionLoaded(MyMissionBase sender)
        {
            MyScriptWrapper.SetEntityEnabled(MyScriptWrapper.GetEntity((uint)EntityID.DoorHubA), false);

            MyScriptWrapper.SetAlarmMode((uint)EntityID.AlarmAutodestruct1, true);
            MyScriptWrapper.SetAlarmMode((uint)EntityID.AlarmAutodestruct2, true);

            MyScriptWrapper.TryUnhide((uint)EntityID.TurretAutodescrut1);
            MyScriptWrapper.TryUnhide((uint)EntityID.TurretAutodescrut2);
            MyScriptWrapper.TryUnhide((uint)EntityID.TurretAutodescrut3);
            MyScriptWrapper.TryUnhide((uint)EntityID.TurretAutodescrut4);

            MyScriptWrapper.SetWaypointListSecrecy(new List <uint> {
                (uint)EntityID.WaypointAutodestruct1, (uint)EntityID.WaypointAutodestruct2
            }, true);

            MissionTimer.RegisterTimerAction(TimeSpan.FromMinutes(1), Autodestruct, false, MyTexts.AutodestructIn, false);
        }
Exemplo n.º 28
0
        private void MissionTimer_Elapsed(object sender, ElapsedEventArgs e)
        {
            RemaingingTime--;
            if (RemaingingTime <= 0)
            {
                if (GameController.IsGameTied() && !GameStarted)
                {
                    GameController.StartGame();
                    GameStarted = true;
                }
                else
                {
                    Logger.Debug("Ending mission");
                    Events.Raise(ServerEvents.EndMission);
                }

                MissionTimer.Stop();
            }
        }
        private void MyScriptWrapperOnBotReachedWaypoint(MyEntity bot, MyEntity waypoint)
        {
            if (m_07followContact.IsAvailable() && waypoint.EntityId.Value.NumericValue == (uint)EntityID.WaypointFollow1 && bot == MyScriptWrapper.GetEntity("Mitchel"))
            {
                MissionTimer.RegisterTimerAction(5000, Follow1Reached, false);
            }

            MySmallShipBot vesselGuardL = (MySmallShipBot)MyScriptWrapper.TryGetEntity("GuardL");
            MySmallShipBot vesselGuardR = (MySmallShipBot)MyScriptWrapper.TryGetEntity("GuardR");

            if (m_waitForTheMoment.IsAvailable() && bot == vesselGuardL && waypoint.EntityId.Value.NumericValue == (uint)EntityID.WaypointGuardL)
            {
                m_guardLReached = true;
            }
            if (m_waitForTheMoment.IsAvailable() && bot == vesselGuardR && waypoint.EntityId.Value.NumericValue == (uint)EntityID.WaypointGuardR)
            {
                m_guardRReached = true;
            }
        }
Exemplo n.º 30
0
 void Update()
 {
     if (MissionTimer.TimeRemaining() < 30.0f)
     {
         if (instance.bgmSource.clip != instance.carryingCustomer)
         {
             instance.bgmSource.clip = instance.carryingCustomer;
             instance.bgmSource.Play();
         }
     }
     else
     {
         if (instance.bgmSource.clip != instance.normalBGM)
         {
             instance.bgmSource.clip = instance.normalBGM;
             instance.bgmSource.Play();
         }
     }
 }
Exemplo n.º 31
0
        static void Main(string[] args)
        {
            var agent = new Agent();
            var lair = new Lair();
            var dice = new Dice(m => new Random(DateTime.Now.Millisecond).Next(100));
            var mission = new InfiltrationMission(dice);

            var timer = new MissionTimer(new LocatorImp());
            timer.Subscribe(mission);

            //wire up the mission complete event
            mission.AsObservable<MissionOutcome>()
                .Subscribe(outcome =>
                               {
                                   Console.WriteLine("Mission complete");
                                   mission.Begin(agent, lair);
                               });

            mission.Begin(agent, lair);
            Console.ReadLine();
        }