public override IEnumerator PlayInternal(CinematicDirector player) { Renderer[] renderers = GameObject.FindObjectsOfType <Renderer>(); for (int i = 0; i < renderers.Length; ++i) { if (renderers[i].material.HasProperty("_Distance")) { CinematicHelpers.MakeMaterialInstancedIfNecessary(renderers[i]); renderers[i].material.SetFloat("_Distance", -1f); } } #if USING_CREATIVESPORE STETilemap[] tileMaps = GameObject.FindObjectsOfType <STETilemap>(); for (int i = 0; i < tileMaps.Length; ++i) { if (tileMaps[i].Material.HasProperty("_Distance")) { CinematicHelpers.MakeMaterialInstancedIfNecessary(tileMaps[i]); tileMaps[i].Material.SetFloat("_Distance", -1f); } } #endif yield break; }
public override IEnumerator PlayInternal(CinematicDirector player) { GameObject target = player.objectMap.GetObjectByName(mTarget); GameObject destination = player.objectMap.GetObjectByName(mDestination); Vector3 startPosition = target.transform.position; if (!string.IsNullOrEmpty(mSource)) { startPosition = player.objectMap.GetObjectByName(mSource).transform.position; target.transform.position = startPosition; } Vector3 endPosition = destination.transform.position; float time = 0f; while (time < mSeconds) { time += Time.deltaTime; Vector3 currentPosition = Vector3.Lerp(startPosition, endPosition, time / mSeconds); target.transform.position = currentPosition; yield return(null); } target.transform.position = endPosition; yield break; }
public override IEnumerator PlayInternal(CinematicDirector player) { Game.instance.playerData.SetFlag(mFlag); player.dataProvider.SetData(mFlag, "true"); yield break; }
public override IEnumerator PlayInternal(CinematicDirector player) { List <string> setups = LocalizedText.GetKeysInList("[" + mType + "_SETUP]"); List <string> punchlines = LocalizedText.GetKeysInList("[" + mType + "_PUNCHLINE]"); int jokeNum = Random.Range(0, setups.Count); string setupKey = setups[jokeNum]; string punchlineKey = punchlines[jokeNum]; string setup = LocalizedText.Get(setupKey); string punchline = LocalizedText.Get(punchlineKey); CinematicActionTypewriter setupAction = new CinematicActionTypewriter(); Dictionary <string, string> setupParams = new Dictionary <string, string>(); setupParams.Add("text", setup); setupParams.Add("keep_open", "true"); setupAction.SetParameters(setupParams); yield return(player.PlayAction(setupAction)); CinematicActionTypewriter punchlineAction = new CinematicActionTypewriter(); Dictionary <string, string> punchlineParams = new Dictionary <string, string>(); punchlineParams.Add("text", punchline); punchlineAction.SetParameters(punchlineParams); yield return(player.PlayAction(punchlineAction)); yield break; }
private void Awake() { if (mInstance != null) { Destroy(gameObject); return; } UnityEngine.SceneManagement.SceneManager.activeSceneChanged += OnActiveSceneChanged; mInstance = this; DontDestroyOnLoad(gameObject); mPlayerStats = GetComponentInChildren <CharacterStatistics>(); mSaveManager = GetComponent <SaveManager>(); mTransitionManager = GetComponentInChildren <ScreenTransitionManager>(); mCinematicDirector = GetComponentInChildren <CinematicDirector>(); mCinematicDataProvider = GetComponentInChildren <CinematicDataProvider>(); mCharacterStatInfo = GetComponentInChildren <CharacterStatInfo>(); mCentralEvents = new CentralEvents(); mCompanionBuilder = GetComponentInChildren <CompanionBuilder>(); mEnemyDirector = GetComponentInChildren <EnemyDirector>(); mSoundManager = GetComponentInChildren <SoundManager>(); mQuirkRegistry = GetComponentInChildren <QuirkRegistry>(); mSaveManager.LoadGame(); playerData.onPlayerDataChanged += OnPlayerDataChanged; playerStats.onCharacterStatisticsChanged += OnPlayerStatsChanged; }
public override IEnumerator PlayInternal(CinematicDirector player) { float seconds = 0f; FollowCamera cameraController = Camera.main.GetComponent <FollowCamera>(); while (seconds < mSeconds) { Vector3 offset = cameraController.animationOffset; offset.x = Mathf.Sin(seconds * mSpeed * 2f * 3.1415f) * mIntensity; offset.y = Mathf.Sin(seconds * mSpeed * 2f * 3.1415f * 0.25f) * mIntensity; cameraController.animationOffset = offset; seconds += Time.deltaTime; yield return(null); } while (cameraController.animationOffset.magnitude > 0.1f) { cameraController.animationOffset *= 0.5f; yield return(null); } cameraController.animationOffset = Vector3.zero; yield break; }
public override IEnumerator PlayInternal(CinematicDirector player) { GameObject questr = player.objectMap.GetObjectByName("questr"); questr.GetComponent <QuestR>().SetTutorialMode(mEnabled); yield break; }
public override IEnumerator PlayInternal(CinematicDirector player) { GameObject target = player.objectMap.GetObjectByName(mTarget); target.SendMessage(mFunction); yield break; }
public override IEnumerator PlayInternal(CinematicDirector player) { if ((mConditionIsTrue && alias == "flag_set") || (!mConditionIsTrue && alias == "flag_unset")) { yield return(PlayChildActions(player)); } yield break; }
public override IEnumerator PlayInternal(CinematicDirector player) { // These are playable if we want them to be - if they evaluate to true, we'll play child actions if (Evaluate(player)) { yield return(PlayChildActions(player)); } yield break; }
public override IEnumerator PlayInternal(CinematicDirector player) { mTimer = 0f; while (mTimer < mSecondsToWait) { mTimer += Time.deltaTime * player.playbackTimeScale; yield return(null); } yield break; }
public override IEnumerator PlayInternal(CinematicDirector player) { GameObject obj = player.objectMap.GetObjectByName("road3"); if (obj != null) { obj.GetComponent <FillRegion>().fillGradually = true; } yield break; }
public override IEnumerator PlayInternal(CinematicDirector player) { GameObject dialog = player.objectMap.GetObjectByName("increase_attractiveness_dialog"); dialog.GetComponent <IncreaseAttractivenessDialog>().ShowDialog(mMessage, mCost, mEffect, mSuccessEvent, mFailEvent); while (dialog.activeInHierarchy) { yield return(null); } yield break; }
public override IEnumerator PlayInternal(CinematicDirector player) { GameObject dialog = player.objectMap.GetObjectByName("buff_stats_dialog"); dialog.GetComponent <BuffStatsDialog>().ShowDialog(); while (dialog.activeInHierarchy) { yield return(null); } yield break; }
public override IEnumerator PlayInternal(CinematicDirector player) { GameObject dialog = player.objectMap.GetObjectByName("choice_dialog"); dialog.GetComponent <GenericChoiceDialog>().Show(mText, mButtons); while (dialog.activeInHierarchy) { yield return(null); } yield break; }
public IEnumerator Play(CinematicDirector player) { complete = false; isPlaying = true; InterpretParameters(player.dataProvider); yield return(PlayInternal(player)); complete = true; isPlaying = false; yield break; }
public override IEnumerator PlayInternal(CinematicDirector player) { GameObject panel = player.objectMap.GetObjectByName("questr_panel"); if (mEnabled) { panel.GetComponent <QuestRPanel>().MoreInfo(); } else { panel.GetComponent <QuestRPanel>().LessInfo(); } yield break; }
public override bool Evaluate(CinematicDirector player) { for (int i = 0; i < mChildActions.Count; ++i) { CinematicRequirement requirement = (CinematicRequirement)mChildActions[i]; requirement.InterpretParameters(player.dataProvider); if (!requirement.Evaluate(player)) { return(false); } } return(true); }
public override IEnumerator PlayInternal(CinematicDirector player) { GameObject target = player.objectMap.GetObjectByName(mTargetTransform); Quaternion currentRotation = FollowCamera.main.transform.rotation; Vector3 currentPosition = FollowCamera.main.transform.position; FollowCamera follow = FollowCamera.main; follow.enabled = false; float time = 0f; while (time < 1f) { Quaternion rotation = Quaternion.Slerp(currentRotation, target.transform.rotation, time); Vector3 position = Vector3.Lerp(currentPosition, target.transform.position, time); FollowCamera.main.transform.rotation = rotation; FollowCamera.main.transform.position = position; time += Time.deltaTime / mTime; yield return(null); } FollowCamera.main.transform.rotation = target.transform.rotation; FollowCamera.main.transform.position = target.transform.position; yield return(new WaitForSeconds(4f)); // TODO bdsowers: this shouldn't move back, but we don't need a separate action/bookkeeping right now while (time > 0f) { Quaternion rotation = Quaternion.Slerp(currentRotation, target.transform.rotation, time); Vector3 position = Vector3.Lerp(currentPosition, target.transform.position, time); FollowCamera.main.transform.rotation = rotation; FollowCamera.main.transform.position = position; time -= Time.deltaTime / mTime; yield return(null); } FollowCamera.main.transform.rotation = currentRotation; FollowCamera.main.transform.position = currentPosition; follow.enabled = true; yield break; }
public override IEnumerator PlayInternal(CinematicDirector player) { GameObject.FindObjectOfType <CollisionMap>().MarkSpace(mMapX, mMapY, 1); yield return(new WaitForSeconds(Random.Range(0.2f, 0.4f))); Vector3 worldCoords = MapCoordinateHelper.MapToWorldCoords(new Vector2Int(mMapX, mMapY)); GameObject newObj = PrefabManager.instance.InstantiatePrefabByName(mPrefabName); newObj.transform.position = worldCoords; // todo bdsowers - this was rushed in for a cinematic newObj.transform.GetChild(0).localPosition = Vector3.up * 7f; newObj.transform.GetChild(0).DOLocalMove(Vector3.zero, Random.Range(0.3f, 0.6f)); yield break; }
public override IEnumerator PlayInternal(CinematicDirector player) { GameObject vfx = PrefabManager.instance.InstantiatePrefabByName("CFX3_Hit_SmokePuff"); GameObject character = CinematicId.FindObjectWithId(mNPCName); if (character == null) { Debug.LogError("Couldn't find character: " + mNPCName); } vfx.transform.position = character.transform.position; GameObject.Destroy(character.gameObject); yield break; }
public override IEnumerator PlayInternal(CinematicDirector player) { GameObject target = player.objectMap.GetObjectByName(mTarget); Renderer renderer = target.GetComponent <Renderer>(); float alpha = mStartValue; while (alpha < 1f) { renderer.material.SetFloat(mProperty, alpha); alpha += (mEndValue - mStartValue) * Time.deltaTime * (1 / mSeconds) * player.playbackTimeScale; yield return(null); } renderer.material.SetFloat(mProperty, mEndValue); yield break; }
public override IEnumerator PlayInternal(CinematicDirector player) { // Mark all the spaces below the rock as unwalkable so nobody teleports there RandomDungeon dungeon = Game.instance.levelGenerator.dungeon; for (int x = 0; x < dungeon.width; ++x) { for (int y = 13; y < dungeon.height; ++y) { if (Game.instance.levelGenerator.collisionMap.SpaceMarking(x, y) == 0) { Game.instance.levelGenerator.collisionMap.MarkSpace(x, y, 1); } } } yield break; }
public override IEnumerator PlayInternal(CinematicDirector player) { TextMeshProUGUI text = player.objectMap.GetObjectByName(mTarget).GetComponent <TextMeshProUGUI>(); float alpha = 1f; while (alpha > 0f) { alpha -= Time.deltaTime * player.playbackTimeScale; text.alpha = alpha; text.characterSpacing += Time.deltaTime * 6f * player.playbackTimeScale; yield return(null); } text.alpha = 0f; yield break; }
public override IEnumerator PlayInternal(CinematicDirector player) { Typewriter target = player.objectMap.GetObjectByName(mTarget).GetComponent <Typewriter>(); if (!mWaitForInteraction) { yield return(target.ShowTextCoroutine(mText, 1f)); } else { target.ShowText(mText, 1f); // Provide a little lag time yield return(new WaitForSeconds(0.25f)); bool keepWaiting = true; BasicActionSet actionSet = Game.instance.actionSet; while (keepWaiting) { if (target.isAnimating) { if (actionSet.Activate.WasPressed || actionSet.Spell.WasPressed) { target.ForceFinish(); } } else { if (actionSet.Activate.WasPressed || actionSet.Spell.WasPressed) { keepWaiting = false; if (!mKeepOpen) { target.HideText(); } } } yield return(null); } } yield break; }
public override IEnumerator PlayInternal(CinematicDirector player) { #if USING_CREATIVESPORE GameObject target = player.objectMap.GetObjectByName(mTarget); STETilemap actualTilemap = target.GetComponent <STETilemap>(); CinematicHelpers.MakeMaterialInstancedIfNecessary(actualTilemap); float distance = -1f; while (distance < 1f) { SetMaterialDistance(actualTilemap, distance); distance += Time.deltaTime * (1 / mSeconds) * 2f * player.playbackTimeScale; yield return(null); } SetMaterialDistance(actualTilemap, 1f); #endif yield break; }
public override IEnumerator PlayInternal(CinematicDirector player) { GameObject speakerContainer = player.objectMap.GetObjectByName("speaker"); bool showSpeaker = (mSpeakerModel != "none"); if (speakerContainer != null) { player.objectMap.GetObjectByName("speaker").SetActive(showSpeaker); } if (showSpeaker) { CharacterModel model = GameObject.Find("CharacterImageCapture").GetComponentInChildren <CharacterModel>(); model.transform.localPosition = new Vector3(0f, 0f, 0.5f); Material material = (mUseSpeakerMaterial ? Game.instance.followerData.material : null); model.ChangeModel(mSpeakerModel, material, false); } yield break; }
public override IEnumerator PlayInternal(CinematicDirector player) { GameObject target = player.objectMap.GetObjectByName(mTarget); Renderer renderer = target.GetComponentInChildren <Renderer>(); CinematicHelpers.MakeMaterialInstancedIfNecessary(renderer); float distance = -1f; while (distance < 1f) { renderer.material.SetFloat("_Distance", distance); distance += Time.deltaTime * (1 / mSeconds) * 2f * player.playbackTimeScale; yield return(null); } renderer.material.SetFloat("_Distance", 1f); yield break; }
/// <summary> /// Plays all the child actions of this action, respecting if they should yield or not before moving forward. /// It's only necessary to call this if we expect to have child actions, which very few actions have. /// </summary> /// <param name="player"></param> /// <returns></returns> protected IEnumerator PlayChildActions(CinematicDirector player) { for (int i = 0; i < mChildActions.Count; ++i) { // TODO bdsowers - this is getting called too much now mChildActions[i].InterpretParameters(player.dataProvider); if (mChildActions[i].shouldYield) { yield return(player.PlayAction(mChildActions[i])); } else { player.PlayAction(mChildActions[i]); } } while (!AllChildActionsFinished()) { yield return(null); } yield break; }
public override IEnumerator PlayInternal(CinematicDirector player) { player.objectMap.GetObjectByName(mTarget).SetActive(false); yield break; }