public override void OnActivated() { WorldItem structureWorldItem = null; StackItem structureStackitem = null; if (WIGroups.FindChildItem(StructurePath, out structureWorldItem)) { if (Player.Local.Surroundings.IsVisitingStructure(structureWorldItem.Get <Structure> ())) { HasCompleted = true; } } }
public void LookForDemolitionController( ) { WorldItem demolitionControllerWorldItem = null; if (WIGroups.FindChildItem(State.DemolitionControllerPath, out demolitionControllerWorldItem)) { DemolitionController = demolitionControllerWorldItem.Get <StructureDemolitionController> (); DemolitionController.AddDemolishable(this); //don't let our colliders turn off worlditem.ActiveState = WIActiveState.Active; worlditem.ActiveStateLocked = true; } }
public bool WaitForStructure( ) { if (TargetStructure == null) { WorldItem childItem = null; if (WIGroups.FindChildItem(TargetStructureReference.GroupPath, TargetStructureReference.FileName, out childItem)) { TargetStructure = childItem.Get <Structure> (); if (TargetStructure != null) { TargetStructure.worlditem.ActiveState = WIActiveState.Active; //TODO remove this lock, could be dangerous TargetStructure.worlditem.ActiveStateLocked = true; Structures.AddInteriorToLoad(TargetStructure); } else { Debug.LogError("Target structure " + TargetStructureReference.FullPath + " had no structure wiscript"); return(true); } } else { Debug.LogError("Couldn't find structure " + TargetStructureReference.FullPath); return(true); } } if (TargetStructure.Is(TargetLoadState)) { if (mPaddedStartTime < 0) { mPaddedStartTime = WorldClock.AdjustedRealTime + 1.5; return(true); } else if (WorldClock.AdjustedRealTime > mPaddedStartTime) { return(false); } } else { mPaddedStartTime = -1; } return(true); }
protected IEnumerator PostIntrospectionOverTime() { //wait for cutscenes / loading / etc. to finsih while (!GameManager.Is(FGameState.InGame) || !Player.Local.HasSpawned) { double waitUntil = Frontiers.WorldClock.AdjustedRealTime + 0.1f; while (Frontiers.WorldClock.AdjustedRealTime < waitUntil) { yield return(null); } } yield return(null); for (int i = 0; i < State.IntrospectionMessages.Count; i++) //if this is the last one, trigger the mission (if any) { if (i == State.IntrospectionMessages.Count - 1) { if (State.ActivateMission) { GUI.GUIManager.PostIntrospection(State.IntrospectionMessages[i], State.ActivatedMissionName, State.Delay); } else { GUI.GUIManager.PostIntrospection(State.IntrospectionMessages[i], State.Delay); } } else { GUI.GUIManager.PostIntrospection(State.IntrospectionMessages[i], State.Delay); } } if (State.PayAttentionToItem) { WorldItem attentionItem = null; if (WIGroups.FindChildItem(State.AttentionItem.GroupPath, State.AttentionItem.FileName, out attentionItem)) { Player.Local.Focus.GetOrReleaseAttention(attentionItem); } } mPostingIntrospectionOverTime = false; yield break; }
protected virtual void OnSuccess( ) { if (!string.IsNullOrEmpty(State.MissionName) && !string.IsNullOrEmpty(State.VariableNameOnSuccess)) { WorldItem itemToDestroy = null; for (int i = 0; i < State.WorldItemsToDestroy.Count; i++) { if (WIGroups.FindChildItem(State.WorldItemsToDestroy [i].FullPath, out itemToDestroy)) { itemToDestroy.RemoveFromGame(); } else { Debug.Log("Couldn't find child item " + State.WorldItemsToDestroy [i].FullPath); } } Missions.Get.ChangeVariableValue(State.MissionName, State.VariableNameOnSuccess, State.VariableValueOnSuccess, State.ChangeTypeOnSuccess); } }
public override bool OnPlayerEnter() { if (TargetWorlditem == null) { if (!WIGroups.FindChildItem(State.WorlditemPath, out TargetWorlditem)) { return(false); } } if (!string.IsNullOrEmpty(State.OriginalState)) { if (TargetWorlditem.State != State.OriginalState) { return(false); } } TargetWorlditem.State = State.NewState; return(true); }
public override bool OnPlayerEnter() { if (mDimmingLanterns) { return(false); } if (LanternsToDim.Count == 0) { WorldItem lanternWorldItem = null; for (int i = 0; i < State.LanternsToDim.Count; i++) { MobileReference mr = State.LanternsToDim[i]; if (WIGroups.FindChildItem(mr.GroupPath, mr.FileName, out lanternWorldItem)) { LanternsToDim.Add(lanternWorldItem); } } if (State.LanternsToDim.Count == 0) { return(false); } } if (GuardInterventionTrigger == null) { WorldTriggerState wts = null; if (ParentChunk.GetTriggerState(State.GuardInterventionTriggerName, out wts)) { GuardInterventionTrigger = wts.trigger as TriggerGuardIntervention; } else { return(false); } } mDimmingLanterns = true; mStartTime = WorldClock.AdjustedRealTime; StartCoroutine(DimLanternsOverTime()); return(true); }
protected IEnumerator WaitForBodiesOfWater() { bool waitForTop = !string.IsNullOrEmpty(State.TopBodyOfWaterPath); bool waitForBottom = !string.IsNullOrEmpty(State.BottomBodyOfWaterPath); while (waitForTop | waitForBottom) { if (waitForTop) { WorldItem bodyOfWaterWorlditem = null; if (WIGroups.FindChildItem(State.TopBodyOfWaterPath, out bodyOfWaterWorlditem)) { BodyOfWater bodyOfWater = bodyOfWaterWorlditem.Get <BodyOfWater> (); WaterfallTopFollow = bodyOfWater.WaterPivot.transform; waitForTop = false; } } if (waitForBottom) { WorldItem bodyOfWaterWorlditem = null; if (WIGroups.FindChildItem(State.BottomBodyOfWaterPath, out bodyOfWaterWorlditem)) { BodyOfWater bodyOfWater = bodyOfWaterWorlditem.Get <BodyOfWater> (); WaterfallBottomFollow = bodyOfWater.WaterPivot.transform; waitForBottom = false; } } double waitUntil = Frontiers.WorldClock.AdjustedRealTime + 0.5f; while (Frontiers.WorldClock.AdjustedRealTime < waitUntil) { yield return(null); } //Debug.Log ("Waiting for top / bottom: " + waitForTop.ToString () + " / " + waitForBottom.ToString ()); } enabled = true; yield break; }
protected IEnumerator UpdateTransitionOverTime() { //player sets off an explosion FXManager.Get.SpawnExplosionFX(State.ExplosionFXType, transform, State.ExplosionPosition); MasterAudio.PlaySound(State.ExplosionSoundType, transform, State.ExplosionSound); Player.Local.Audio.Cough(); //explosion makes them go blind CameraFX.Get.SetBlind(true); CameraFX.Get.AddDamageOverlay(1f); double waitUntil = WorldClock.AdjustedRealTime + State.CharacterDTSDelay; while (WorldClock.AdjustedRealTime < waitUntil) { yield return(null); } //robert says some DTS Frontiers.GUI.NGUIScreenDialog.AddSpeech(State.CharacterDTSText, State.CharacterDTSName, State.CharacterDTSDuration); Player.Local.Audio.Cough(); Player.Local.MovementLocked = true; //force the two camps to rebuild for (int i = 0; i < State.ForceRebuildLocations.Count; i++) { WorldItem activeLocation = null; if (WIGroups.FindChildItem(State.ForceRebuildLocations[i], out activeLocation)) { activeLocation.Get <MissionInteriorController>().ForceRebuild(); } else { Debug.Log("Couldn't load location " + State.ForceRebuildLocations[i]); } } //wait for a bit while that settles in waitUntil = WorldClock.AdjustedRealTime + State.CharacterDTSDuration; while (WorldClock.AdjustedRealTime < waitUntil) { yield return(null); } //player is moved to temple entrance GameWorld.Get.ShowAboveGround(true); Player.Local.Surroundings.ExitUnderground(); waitUntil = WorldClock.AdjustedRealTime + 0.1f; while (WorldClock.AdjustedRealTime < waitUntil) { yield return(null); } //give gameworld a sec to catch up //lock the player's position for a moment //kill the guard at the temple door WorldTriggerState triggerState = null; List <WorldTrigger> triggers = GameWorld.Get.PrimaryChunk.Triggers; for (int i = 0; i < triggers.Count; i++) { if (triggers[i].name == "TriggerWarlockCampGuardIntervention") { //get the trigger and kill the guard //(due to the cave-in) TriggerGuardIntervention tgi = triggers[i].GetComponent <TriggerGuardIntervention>(); tgi.KillGuard(); break; } } Player.Local.Position = State.PlayerWakeUpPosition; //blindness goes away CameraFX.Get.SetBlind(false); //as the player wakes up have him look at Robert Player.Local.HijackControl(); double startHijackedTime = WorldClock.AdjustedRealTime; HijackedPosition = gameObject.CreateChild("HijackedPosition"); HijackedLookTarget = gameObject.CreateChild("HijackedLookTarget"); HijackedPosition.position = State.PlayerWakeUpPosition; HijackedLookTarget.position = State.PlayerWakeUpLookTarget; while (WorldClock.AdjustedRealTime < startHijackedTime + State.HijackedTimeDuration) { Player.Local.SetHijackTargets(HijackedPosition, HijackedLookTarget); yield return(null); } Character character = null; if (!Characters.Get.SpawnedCharacter("Robert", out character)) { //spawn Robert if we haven't already CharacterSpawnRequest spawnRequest = new CharacterSpawnRequest(); spawnRequest.ActionNodeName = "RobertPiecesTempleSpawn"; spawnRequest.FinishOnSpawn = true; spawnRequest.CharacterName = "Robert"; spawnRequest.MinimumDistanceFromPlayer = 3f; spawnRequest.SpawnBehindPlayer = false; spawnRequest.UseGenericTemplate = false; spawnRequest.CustomConversation = "Robert-Enc-Act-02-Pieces-05"; Player.Local.CharacterSpawner.AddSpawnRequest(spawnRequest); } Player.Local.RestoreControl(true); Player.Local.MovementLocked = false; GameObject.Destroy(HijackedPosition.gameObject, 0.5f); GameObject.Destroy(HijackedLookTarget.gameObject, 0.5f); //and we're done! yield break; }