private void FadeCharacter(bool fadein, StoryCharacter chara) { if (fadein) { chara.FadeIn(); } else { chara.FadeOut(); } }
private void FocusChara(StoryCharacter pickup_chara) { if (!(pickup_chara == null)) { charas.ForEach(delegate(StoryCharacter o) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Expected O, but got Unknown TweenColor.Begin(o.uiTex.get_gameObject(), 0.1f, (!(o == pickup_chara) && !(pickup_chara == null)) ? new Color(0.5f, 0.5f, 0.5f, 1f) : new Color(1f, 1f, 1f, 1f)); }); } }
public string ParseTeamText(string text, StoryCharacter character) { if (character.Position == Position.LeftArbiter) { text = text.Replace("[Name]", "[LAName]"); text = text.Replace("[Title]", "[LATitle]"); text = text.Replace("[PName]", "[LVName]"); text = text.Replace("[PTitle]", "[LVTitle]"); text = text.Replace("[OName]", "[RAName]"); text = text.Replace("[OTitle]", "[RATitle]"); text = text.Replace("[OVName]", "[RVName]"); text = text.Replace("[OVTitle]", "[RVTitle]"); } if (character.Position == Position.RightArbiter) { text = text.Replace("[Name]", "[RAName]"); text = text.Replace("[Title]", "[RATitle]"); text = text.Replace("[PName]", "[RVName]"); text = text.Replace("[PTitle]", "[RVTitle]"); text = text.Replace("[OName]", "[LAName]"); text = text.Replace("[OTitle]", "[LATitle]"); text = text.Replace("[OVName]", "[LVName]"); text = text.Replace("[OVTitle]", "[LVTitle]"); } if (character.Position == Position.LeftVictim) { text = text.Replace("[Name]", "[LVName]"); text = text.Replace("[Title]", "[LVTitle]"); text = text.Replace("[PName]", "[LAName]"); text = text.Replace("[PTitle]", "[LATitle]"); text = text.Replace("[OName]", "[RAName]"); text = text.Replace("[OTitle]", "[RATitle]"); text = text.Replace("[OVName]", "[RVName]"); text = text.Replace("[OVTitle]", "[RVTitle]"); } if (character.Position == Position.RightVictim) { text = text.Replace("[Name]", "[RVName]"); text = text.Replace("[Title]", "[RVTitle]"); text = text.Replace("[PName]", "[RAName]"); text = text.Replace("[PTitle]", "[RATitle]"); text = text.Replace("[OName]", "[LAName]"); text = text.Replace("[OTitle]", "[LATitle]"); text = text.Replace("[OVName]", "[LVName]"); text = text.Replace("[OVTitle]", "[LVTitle]"); } return(text); }
public void SetCharacters(StoryCharacter leftCharacter, StoryCharacter rightCharacter) { if (leftCharacter) { this.leftCharacter.sprite = leftCharacter.NeutralSprites.Normal; this.leftCharacterTalking.sprite = leftCharacter.NeutralSprites.Talking; LeftCharacterCache = leftCharacter; LeftStagePos = StagePosition.OffStage; } if (rightCharacter) { this.rightCharacter.sprite = rightCharacter.NeutralSprites.Normal; this.rightCharacterTalking.sprite = rightCharacter.NeutralSprites.Talking; RightCharacterChache = rightCharacter; RightStagePos = StagePosition.OffStage; } }
public static StoryCharacter Initialize(int id, UITexture ui_tex, string _name, string _dir, string idle_anim) { //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Expected O, but got Unknown //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Expected O, but got Unknown NPCTable.NPCData nPCData = Singleton <NPCTable> .I.GetNPCData(_name); if (nPCData == null) { return(null); } UIRenderTexture uIRenderTexture = UIRenderTexture.Get(ui_tex, -1f, true, -1); uIRenderTexture.Disable(); uIRenderTexture.nearClipPlane = 1f; uIRenderTexture.farClipPlane = 100f; Transform val = Utility.CreateGameObject("StoryModel", uIRenderTexture.modelTransform, uIRenderTexture.renderLayer); StoryCharacter storyCharacter = val.get_gameObject().AddComponent <StoryCharacter>(); storyCharacter.model = val; storyCharacter.id = id; storyCharacter.renderTex = uIRenderTexture; storyCharacter.uiTex = ui_tex; storyCharacter.charaName = _name; storyCharacter.aliasName = string.Empty; storyCharacter.SetStandPosition(_dir, false); if (string.IsNullOrEmpty(idle_anim)) { storyCharacter.idleAnim = PlayerAnimCtrl.StringToEnum(nPCData.anim); } else { storyCharacter.idleAnim = PlayerAnimCtrl.StringToEnum(idle_anim); } storyCharacter.isLoading = true; ModelLoaderBase modelLoaderBase = nPCData.LoadModel(val.get_gameObject(), false, false, storyCharacter.OnModelLoadComplete, false); storyCharacter.npcLoader = (modelLoaderBase as NPCLoader); storyCharacter.CollectTween(ui_tex.get_transform()); return(storyCharacter); }
public void Char2(string charName, string charPortrait) { if (charName == "none") { Character2.gameObject.SetActive(false); currentCharacter = null; if (!char1Active) { UpdateCharacter(); } return; } char1Active = false; charName = charName.ToLower(); charPortrait = charPortrait.ToLower(); currentCharacter = StoryManager.Instance.Characters.FirstOrDefault(x => x.Name.ToLower() == charName); if (currentCharacter == null) { throw new System.ArgumentException("failed change of character 2, character \"" + charName + "\" was not found!", "charName"); } var currentPortrait = currentCharacter.Portraits.FirstOrDefault(x => x.Name.ToLower() == charPortrait); if (currentPortrait == null) { throw new System.ArgumentException("failed change of character 2, portrait \"" + charPortrait + "\" was not found!", "charPortrait"); } Character2Face.sprite = currentPortrait.Sprite; Character2.transform.SetParent(ActiveCharacters, false); Character1.transform.SetParent(BackgroundCharacters, false); Character2.gameObject.SetActive(true); UpdateCharacter(); }
public void SetCharacterEmotion(StoryCharacter character, Emotion emotion) { Sprite newNormal = null; Sprite newTalking = null; switch (emotion) { case Emotion.Happy: newNormal = character.HappySprites.Normal; newTalking = character.HappySprites.Talking; break; case Emotion.Neutral: newNormal = character.NeutralSprites.Normal; newTalking = character.NeutralSprites.Talking; break; case Emotion.Upset: newNormal = character.UpsetSprites.Normal; newTalking = character.UpsetSprites.Talking; break; case Emotion.Stoned: newNormal = character.StonedSprites.Normal; newTalking = character.StonedSprites.Talking; break; } if (character == LeftCharacterCache) { this.leftCharacter.sprite = newNormal; this.leftCharacterTalking.sprite = newTalking; } if (character == RightCharacterChache) { this.rightCharacter.sprite = newNormal; this.rightCharacterTalking.sprite = newTalking; } }
private IEnumerator RunScript() { Transform camera_t = MonoBehaviourSingleton <AppMain> .I.mainCameraTransform; for (int cmd_row = 0; cmd_row < scriptCommands.Count; cmd_row++) { string cmd = scriptCommands[cmd_row].cmd; string p0 = scriptCommands[cmd_row].p0; string p = scriptCommands[cmd_row].p1; string p2 = scriptCommands[cmd_row].p2; string p3 = scriptCommands[cmd_row].p3; string msg = scriptCommands[cmd_row].msg; switch (cmd) { case "WAIT": { float time = (!string.IsNullOrEmpty(p0)) ? float.Parse(p0) : 0f; while (true) { yield return((object)null); if (time > 0f) { time -= Time.get_deltaTime(); } else if (!MonoBehaviourSingleton <ResourceManager> .I.isLoading && !InstantiateManager.isBusy && !MonoBehaviourSingleton <TransitionManager> .I.isTransing && !(charas.Find((StoryCharacter o) => o.isMoving) != null) && !cameraPosAnim.IsPlaying()) { break; } } break; } case "FADE_IN": eventReceiver.FadeIn(); break; case "FADE_OUT": { Color c = Color.get_black(); switch (p0) { case "BLUE": c = Color.get_blue(); break; case "WHITE": c = Color.get_white(); break; case "RED": c = Color.get_red(); break; case "YELLOW": c = Color.get_yellow(); break; } eventReceiver.FadeOut(c); break; } case "CHR_EASE": { StoryCharacter.EaseDir type = (!(p == "L")) ? StoryCharacter.EaseDir.RIGHT : StoryCharacter.EaseDir.LEFT; bool forward = (!(p2 == "IN")) ? true : false; StoryCharacter chara = FindChara(p0); if (chara != null) { while (chara.isLoading) { yield return((object)null); } chara.PlayTween(type, forward, null); } break; } case "EFF_SHOW": { LoadObject load_obj = effectPrefabs.Get(p0); if (load_obj != null) { while (load_obj.isLoading) { yield return((object)null); } Transform effect = ResourceUtility.Realizes(load_obj.loadedObject, effectRenderTex.modelTransform, 1); Vector3 pos = Vector3.get_zero(); StoryCharacter chara2 = FindChara(p); if (chara2 != null) { pos = chara2.model.get_position(); } Vector3 position = camera_t.get_position(); pos.y = position.y; effect.set_position(pos); if (float.TryParse(p2, out float scale)) { effect.set_localScale(new Vector3(scale, scale, scale)); } } break; } case "SE_PLAY": { int se_id = int.Parse(p0); SoundManager.PlayOneShotUISE(se_id); break; } case "BGM_CHANGE": { int bgm_id = int.Parse(p0); MonoBehaviourSingleton <SoundManager> .I.requestBGMID = bgm_id; break; } case "CHR_SHOW": { StoryCharacter chara5 = FindChara(p0); if (chara5 != null) { while (chara5.isLoading) { yield return((object)null); } FadeCharacter(true, chara5); yield return((object)new WaitForSeconds(MonoBehaviourSingleton <OutGameSettingsManager> .I.storyScene.charaFadeTime)); } break; } case "CHR_HIDE": { StoryCharacter chara7 = FindChara(p0); if (chara7 != null) { while (chara7.isLoading) { yield return((object)null); } FadeCharacter(false, chara7); yield return((object)new WaitForSeconds(MonoBehaviourSingleton <OutGameSettingsManager> .I.storyScene.charaFadeTime)); } break; } case "CHR_ROT": { StoryCharacter chara8 = FindChara(p0); if (chara8 != null) { float angle; if (string.IsNullOrEmpty(p)) { chara8.RotateDefault(); } else if (p == "F") { chara8.RotateFront(); } else if (float.TryParse(p, out angle)) { chara8.RotateAngle(angle); } } break; } case "CHR_POSE": { StoryCharacter chara9 = FindChara(p0); if (chara9 != null) { chara9.RequestPose(p); } break; } case "CHR_STAND": { StoryCharacter chara10 = FindChara(p0); if (chara10 != null) { chara10.SetStandPosition(p, true); } break; } case "CHR_SCALE": { StoryCharacter chara11 = FindChara(p0); if (chara11 != null) { Vector3 scale2 = new Vector3 { x = float.Parse(p), y = float.Parse(p), z = float.Parse(p) }; chara11.SetModelScale(scale2); } break; } case "CHR_FACE": { StoryCharacter chara12 = FindChara(p0); if (chara12 != null) { chara12.RequestFace(p, p2); } break; } case "CAM_SET": { int camIndex2 = int.Parse(p0); if (0 <= camIndex2 && cameraPositions.Length > camIndex2) { float x = float.Parse(p); float y = float.Parse(p2); float z = float.Parse(p3); cameraPositions[camIndex2] = new Vector3(x, y, z); } break; } case "CAM_MOV": { int camIndex = int.Parse(p0); if (0 <= camIndex && cameraPositions.Length > camIndex) { ((InterpolatorBase <Vector3>)cameraPosAnim).Set(0.3f, cameraPositions[camIndex], null, default(Vector3), null); cameraPosAnim.Play(); } break; } case "CAM_PAN": { StoryCharacter chara6 = FindChara(p0); if (chara6 != null) { int charaShowCount = GetCharaShowCount(); switch (charaShowCount) { case 1: { Vector3 position2 = chara6.model.get_position(); Vector3 pos3; pos3.x = position2.x; Transform chara_neck = (!(p == "F")) ? Utility.Find(chara6.model, "Neck") : Utility.Find(chara6.model, "Spine01"); if (chara_neck != null) { Vector3 position3 = chara_neck.get_position(); pos3.y = position3.y; } else { pos3.y = initCameraPos.y; } if (p == "N") { pos3.z = MonoBehaviourSingleton <OutGameSettingsManager> .I.storyScene.cameraPanNearZ; } else if (p == "F") { pos3.z = MonoBehaviourSingleton <OutGameSettingsManager> .I.storyScene.cameraPanFarZ; } else { pos3.z = MonoBehaviourSingleton <OutGameSettingsManager> .I.storyScene.cameraPanNormalZ; } ((InterpolatorBase <Vector3>)cameraPosAnim).Set(0.3f, pos3, null, default(Vector3), null); cameraPosAnim.Play(); break; } case 2: ((InterpolatorBase <Vector3>)cameraPosAnim).Set(0.3f, MonoBehaviourSingleton <OutGameSettingsManager> .I.storyScene.duoCameraPos, null, default(Vector3), null); cameraPosAnim.Play(); break; default: if (3 <= charaShowCount) { ((InterpolatorBase <Vector3>)cameraPosAnim).Set(0.3f, MonoBehaviourSingleton <OutGameSettingsManager> .I.storyScene.trioCameraPos, null, default(Vector3), null); cameraPosAnim.Play(); } break; } } else { Vector3 pos2; pos2.x = 0f; pos2.y = initCameraPos.y; pos2.z = 0f; ((InterpolatorBase <Vector3>)cameraPosAnim).Set(0.3f, pos2, null, default(Vector3), null); cameraPosAnim.Play(); } break; } case "CHR_ALIAS": { StoryCharacter chara4 = FindChara(p0); if (chara4 != null) { chara4.SetAliasName(p); } break; } case "MSG": { MSG_TYPE msg_type = MSG_TYPE.NORMAL; if (p == "M" || p == "MONOLOGUE") { msg_type = MSG_TYPE.MONOLOGUE; } waitMessage = true; StoryCharacter chara3 = FindChara(p0); msg = GetReplacedText(msg); eventReceiver.AddMessage((!(chara3 != null)) ? p0 : chara3.displayName, msg, (chara3 != null) ? chara3.dir : POS.NONE, msg_type); if (!string.IsNullOrEmpty(p2)) { int voice_id = int.Parse(p2); SoundManager.PlayVoice(voice_id, 1f, 0u, null, null); } break; } case "BG": { bool isFirstLoad = false; LoadingQueue load_queue = new LoadingQueue(this); if (locationRednerTex != null) { locationRednerTex.Release(); } else { isFirstLoad = true; } int loc_image_id = int.Parse(p0); int loc_sky_id = int.Parse(p); ResourceManager.enableCache = false; LoadObject lo_loc_image = (loc_image_id <= 0) ? null : load_queue.Load(RESOURCE_CATEGORY.STORY_LOCATION_IMAGE, ResourceName.GetStoryLocationImage(loc_image_id), false); LoadObject lo_loc_sky = (loc_sky_id <= 0) ? null : load_queue.Load(RESOURCE_CATEGORY.STORY_LOCATION_SKY, ResourceName.GetStoryLocationSky(loc_sky_id), false); yield return((object)load_queue.Wait()); ResourceManager.enableCache = true; locationRednerTex = UIRenderTexture.Get(locationTex, -1f, false, 0); locationRednerTex.Disable(); locationRednerTex.orthographicSize = (float)locationTex.height * 0.5f * 0.01f; locationRednerTex.modelTransform.set_position(new Vector3(0f, 0f, 10f)); locationRoot = Utility.CreateGameObject("LocationRoot", locationRednerTex.modelTransform, locationRednerTex.renderLayer); locationRoot.set_localPosition(new Vector3(0f, 0f, 3f)); locationRoot.set_localScale(new Vector3(0.01f, 0.01f, 1f)); if (lo_loc_image != null) { locationImageRoot = Utility.CreateGameObject("LocationImageRoot", locationRoot, locationRednerTex.renderLayer); locationImage = ResourceUtility.Realizes(lo_loc_image.loadedObject, locationImageRoot, locationRednerTex.renderLayer); } if (lo_loc_sky != null) { locationSky = ResourceUtility.Realizes(lo_loc_sky.loadedObject, locationRoot, locationRednerTex.renderLayer); locationSky.set_localPosition(new Vector3(0f, 0f, 1f)); } locationRednerTex.Enable(0.25f); if (isFirstLoad) { eventReceiver.EndLoadFirstBG(); } break; } } while (waitMessage) { yield return((object)null); } } isRunning = false; FocusChara(null); eventReceiver.EndStory(); }
private IEnumerator LoadScriptResources() { Transform camera_t = MonoBehaviourSingleton <AppMain> .I.mainCameraTransform; initCameraPos = camera_t.get_position(); cameraPosAnim.Set(initCameraPos); LoadingQueue load_queue = new LoadingQueue(this); for (int cmd_row = 0; cmd_row < scriptCommands.Count; cmd_row++) { string cmd = scriptCommands[cmd_row].cmd; string p4 = scriptCommands[cmd_row].p0; string p3 = scriptCommands[cmd_row].p1; string p2 = scriptCommands[cmd_row].p2; switch (cmd) { case "EFF_SHOW": { LoadObject load_obj = load_queue.LoadEffect(RESOURCE_CATEGORY.EFFECT_ACTION, p4, false); effectPrefabs.Add(p4, load_obj); if (effectRenderTex == null) { effectRenderTex = UIRenderTexture.Get(effectTex, -1f, true, 1); effectRenderTex.Enable(0.25f); } break; } case "SE_PLAY": try { int se_id = int.Parse(p4); load_queue.CacheSE(se_id, null); } catch { Log.Error(LOG.EXCEPTION, "{0}コマンドのSEIDに整数ではない値が指定されています。", cmd); } break; case "MSG": if (!string.IsNullOrEmpty(p2)) { try { int voice_id = int.Parse(p2); load_queue.CacheVoice(voice_id, null); } catch { Log.Error(LOG.EXCEPTION, "{0}コマンドのボイスIDに整数ではない値が指定されています。", cmd); } } break; case "CHR_LOAD": { int id = -1; for (int i = 0; (float)i < 4f; i++) { if (charas.Find((StoryCharacter o) => o.id == ((_003CLoadScriptResources_003Ec__IteratorC1) /*Error near IL_02d5: stateMachine*/)._003Ci_003E__11) == null) { id = i; break; } } if (id != -1) { UITexture ui_tex = eventReceiver.GetModelUITexture(id); if (ui_tex != null) { StoryCharacter chara = StoryCharacter.Initialize(id, ui_tex, p4, p3, p2); if (chara != null) { charas.Add(chara); } } } break; } } } while (MonoBehaviourSingleton <ResourceManager> .I.isLoading || InstantiateManager.isBusy) { yield return((object)null); } isLoading = false; }
//解析故事文件 ChatActionBox ParseActionList(string[] list) { ChatActionBox box = new ChatActionBox(); box.ActionList = new ArrayList(); box.CharacterList = new ArrayList(); //读取故事的类型,如果为0则读取类型为角色模式,如果为1则读取类型为故事模式 int loadType = 0; foreach (string str in list) { //如果碰见注释符号或为空行,则忽略本行 if (str.Contains("//") || str == "") { continue; } //设置读取类型 if (str == "[Character]") { loadType = 0; continue; } else if (str == "[ChatList]") { loadType = 1; continue; } //读取角色模式的方法 if (loadType == 0) { StoryCharacter character = new StoryCharacter(); character.CharacterID = str.Substring(0, str.IndexOf("<")); string tempstr = str.Substring(str.IndexOf("<") + 1, str.IndexOf(">") - character.CharacterID.Length - 1); string[] parameter = tempstr.Split(';'); for (int i = 0; i < parameter.Length; i++) { //读取name if (i == 0) { character.Root = parameter[i].Substring(5, parameter[i].Length - 5); } } box.CharacterList.Add(character); } //读取故事模式的方法 else if (loadType == 1) { string[] talks = str.Split(':'); if (talks.Length < 2) { talks = str.Split(':'); } box.ActionList.Add(talks); } } return(box); }
// Update is called once per frame void Update() { this.beatTimer -= Time.deltaTime; // Do updates based on story beat. if (this.storyBeat == Beat.TUTORIAL_GHOSTIGHOST_EMERGE) { if (this.state == State.BEAT_FIRST_UPDATE) { this.musicManager.PlayGhostighostTheme(); this.ghostighost = Instantiate(PrefabManager.GHOSTIGHOST_PREFAB).GetComponent <StoryCharacter>(); this.state = State.BEAT_ACTIVE; } if (this.beatTimer < 0f) { this.GotoBeat(Beat.TUTORIAL_PICKUP_ORB); } } else if (this.storyBeat == Beat.TUTORIAL_PICKUP_ORB) { if (this.state == State.BEAT_FIRST_UPDATE) { dm.SetFile("intro"); dm.StartScene("tutorial-pickup-orb"); this.state = State.BEAT_ACTIVE; } else if (this.state == State.BEAT_ACTIVE) { if (dm.endOfScene) { this.GotoBeat(Beat.TUTORIAL_PICKUP_ORB_INSTRUCTIONS); } } } else if (this.storyBeat == Beat.TUTORIAL_PICKUP_ORB_INSTRUCTIONS) { if (this.state == State.BEAT_FIRST_UPDATE) { dm.SetFile("intro"); dm.StartScene("tutorial-pickup-orb-instructions", false); this.state = State.BEAT_ACTIVE; } else if (this.state == State.BEAT_ACTIVE) { if (this.main.item != null) { Orb orb = this.main.item.GetComponent <Orb>(); if (orb != null) { if (orb.orbColor == Orb.OrbColor.BLUE && this.main.item.state == Item.State.PICKED_UP) { this.GotoBeat(Beat.TUTORIAL_DROP_ORB); } } } } else if (this.state == State.PROMPT) { dm.SetFile("intro"); dm.StartScene("tutorial-pickup-orb-prompt"); this.state = State.BEAT_ACTIVE; } } else if (this.storyBeat == Beat.TUTORIAL_DROP_ORB) { if (this.state == State.BEAT_FIRST_UPDATE) { dm.SetFile("intro"); dm.StartScene("tutorial-drop-orb"); this.state = State.BEAT_ACTIVE; } else if (this.state == State.BEAT_ACTIVE) { if (dm.endOfScene) { this.GotoBeat(Beat.TUTORIAL_DROP_ORB_INSTRUCTIONS); } } } else if (this.storyBeat == Beat.TUTORIAL_DROP_ORB_INSTRUCTIONS) { if (this.state == State.BEAT_FIRST_UPDATE) { dm.SetFile("intro"); dm.StartScene("tutorial-drop-orb-instructions", false); this.state = State.BEAT_ACTIVE; } else if (this.state == State.BEAT_ACTIVE) { bool allOnGround = true; foreach (Orb orb in FindObjectsOfType <Orb>()) { Item item = orb.GetComponent <Item>(); if (item.state != Item.State.ON_GROUND) { allOnGround = false; break; } } if (allOnGround) { this.GotoBeat(Beat.TUTORIAL_SUMMON_MONSTER); } } } else if (this.storyBeat == Beat.TUTORIAL_SUMMON_MONSTER) { if (this.state == State.BEAT_FIRST_UPDATE) { dm.SetFile("intro"); dm.StartScene("tutorial-summon-monster"); this.state = State.BEAT_ACTIVE; } else if (this.state == State.BEAT_ACTIVE) { if (dm.endOfScene) { this.GotoBeat(Beat.TUTORIAL_SUMMON_MONSTER_INSTRUCTIONS); } } } else if (this.storyBeat == Beat.TUTORIAL_SUMMON_MONSTER_INSTRUCTIONS) { if (this.state == State.BEAT_FIRST_UPDATE) { dm.SetFile("intro"); dm.StartScene("tutorial-summon-monster-instructions", false); this.state = State.BEAT_ACTIVE; } else if (this.state == State.BEAT_ACTIVE) { FireSalamander salamander = FindObjectOfType <FireSalamander>(); if (salamander != null) { if (salamander.state == Monster.State.WANDER) { this.GotoBeat(Beat.TUTORIAL_RELEASE_MONSTER); } } } else if (this.state == State.PROMPT) { dm.SetFile("intro"); dm.StartScene("tutorial-summon-monster-prompt"); this.state = State.BEAT_ACTIVE; } } else if (this.storyBeat == Beat.TUTORIAL_RELEASE_MONSTER) { if (this.state == State.BEAT_FIRST_UPDATE) { dm.SetFile("intro"); dm.StartScene("tutorial-release-monster"); this.state = State.BEAT_ACTIVE; } else if (this.state == State.BEAT_ACTIVE) { if (dm.endOfScene) { this.GotoBeat(Beat.TUTORIAL_RELEASE_MONSTER_INSTRUCTIONS); } } } else if (this.storyBeat == Beat.TUTORIAL_RELEASE_MONSTER_INSTRUCTIONS) { if (this.state == State.BEAT_FIRST_UPDATE) { dm.SetFile("intro"); dm.StartScene("tutorial-release-monster-instructions", false); this.state = State.BEAT_ACTIVE; } else if (this.state == State.BEAT_ACTIVE) { FireSalamander salamander = FindObjectOfType <FireSalamander>(); if (salamander == null) { this.GotoBeat(Beat.TUTORIAL_SALAMANDER); } } } else if (this.storyBeat == Beat.TUTORIAL_SALAMANDER) { if (this.state == State.BEAT_FIRST_UPDATE) { dm.SetFile("intro"); dm.StartScene("tutorial-salamander"); this.state = State.BEAT_ACTIVE; } else if (this.state == State.BEAT_ACTIVE) { if (dm.endOfScene) { this.GotoBeat(Beat.TUTORIAL_SALAMANDER_ESCAPE); } } } else if (this.storyBeat == Beat.TUTORIAL_SALAMANDER_ESCAPE) { if (this.state == State.BEAT_FIRST_UPDATE) { dm.SetFile("intro"); dm.StartScene("tutorial-salamander-escape", false); this.state = State.BEAT_ACTIVE; } else if (this.state == State.BEAT_ACTIVE) { bool allSalamanders = true; Monster[] monsters = FindObjectsOfType <Monster>(); foreach (Monster monster in monsters) { if (!(monster is FireSalamander)) { allSalamanders = false; break; } } if (!allSalamanders) { this.GotoBeat(Beat.TUTORIAL_ENDING); } } } else if (this.storyBeat == Beat.TUTORIAL_ENDING) { if (this.state == State.BEAT_FIRST_UPDATE) { dm.SetFile("intro"); dm.StartScene("tutorial-ending"); this.state = State.BEAT_ACTIVE; } else if (this.state == State.BEAT_ACTIVE) { if (dm.endOfScene) { this.ghostighost.ReturnToVoid(); this.ghostighost = null; this.GotoBeat(Beat.FREE_PLAY_1); } } } else if (this.storyBeat == Beat.FREE_PLAY_1) { if (this.state == State.BEAT_FIRST_UPDATE) { this.musicManager.PlayMainTheme(); this.state = State.BEAT_ACTIVE; } } else if (this.storyBeat == Beat.INTERLUDE_1_PABS_EMERGE) { if (this.state == State.BEAT_FIRST_UPDATE) { this.musicManager.PlayPabsTheme(); this.state = State.BEAT_ACTIVE; this.pabs = Instantiate(PrefabManager.PABS_PREFAB).GetComponent <StoryCharacter>(); } else if (this.state == State.BEAT_ACTIVE) { if (this.beatTimer < 0f) { this.GotoBeat(Beat.INTERLUDE_1_PABS_TALK); } } } else if (this.storyBeat == Beat.INTERLUDE_1_PABS_TALK) { if (this.state == State.BEAT_FIRST_UPDATE) { dm.SetFile("goblin_encounter_1"); dm.StartScene("interlude1-pabs-talk"); this.hintManager.SetActiveHint(HintManager.Hint.MAKE_GHOST_ORB); this.state = State.BEAT_ACTIVE; } else if (this.state == State.BEAT_ACTIVE) { if (dm.endOfScene) { this.pabs.ReturnToVoid(); this.pabs = null; this.GotoBeat(Beat.FREE_PLAY_2); } } } else if (this.storyBeat == Beat.FREE_PLAY_2) { if (this.state == State.BEAT_FIRST_UPDATE) { this.musicManager.PlayMainTheme(); this.state = State.BEAT_ACTIVE; } } else if (this.storyBeat == Beat.INTERLUDE_2_PABS_EMERGE) { if (this.state == State.BEAT_FIRST_UPDATE) { this.musicManager.PlayPabsTheme(); this.state = State.BEAT_ACTIVE; this.pabs = Instantiate(PrefabManager.PABS_PREFAB).GetComponent <StoryCharacter>(); } else if (this.state == State.BEAT_ACTIVE) { if (this.beatTimer < 0f) { this.GotoBeat(Beat.INTERLUDE_2_PABS_TALK); } } } else if (this.storyBeat == Beat.INTERLUDE_2_PABS_TALK) { if (this.state == State.BEAT_FIRST_UPDATE) { dm.SetFile("win_encounter"); dm.StartScene("ghost_orb_created"); this.state = State.BEAT_ACTIVE; } else if (this.state == State.BEAT_ACTIVE) { if (dm.endOfScene) { this.GotoBeat(Beat.FREE_PLAY_3); } } } else if (this.storyBeat == Beat.FREE_PLAY_3) { if (this.state == State.BEAT_FIRST_UPDATE) { this.state = State.BEAT_ACTIVE; } if (this.state == State.BEAT_ACTIVE) { Ghost ghost = FindObjectOfType <Ghost>(); if (ghost != null && ghost.state == Monster.State.WANDER) { this.GotoBeat(Beat.INTERLUDE_3_PABS_TALK); } } } else if (this.storyBeat == Beat.INTERLUDE_3_PABS_TALK) { if (this.state == State.BEAT_FIRST_UPDATE) { dm.SetFile("win_encounter"); dm.StartScene("one_orb_to_summon"); this.hintManager.SetActiveHint(HintManager.Hint.MAKE_TWO_GHOST_ORBS); this.state = State.BEAT_ACTIVE; } else if (this.state == State.BEAT_ACTIVE) { if (dm.endOfScene) { this.pabs.ReturnToVoid(); this.pabs = null; this.GotoBeat(Beat.FREE_PLAY_4); } } } else if (this.storyBeat == Beat.FREE_PLAY_4) { if (this.state == State.BEAT_FIRST_UPDATE) { this.musicManager.PlayMainTheme(); this.state = State.BEAT_ACTIVE; } } else if (this.storyBeat == Beat.ENDING_PABS_EMERGE) { if (this.state == State.BEAT_FIRST_UPDATE) { this.musicManager.PlayPabsTheme(); this.state = State.BEAT_ACTIVE; this.pabs = Instantiate(PrefabManager.PABS_PREFAB).GetComponent <StoryCharacter>(); } else if (this.state == State.BEAT_ACTIVE) { if (this.beatTimer < 0f) { this.GotoBeat(Beat.ENDING_PABS_TALK); } } } else if (this.storyBeat == Beat.ENDING_PABS_TALK) { if (this.state == State.BEAT_FIRST_UPDATE) { dm.SetFile("win_encounter"); dm.StartScene("win_scene"); this.hintManager.SetActiveHint(HintManager.Hint.YOU_WIN); this.state = State.BEAT_ACTIVE; } else if (this.state == State.BEAT_ACTIVE) { if (dm.endOfScene) { this.pabs.ReturnToVoid(); this.pabs = null; this.GotoBeat(Beat.FREE_PLAY_5); } } } else if (this.storyBeat == Beat.FREE_PLAY_5) { if (this.state == State.BEAT_FIRST_UPDATE) { this.musicManager.PlayGhostighostTheme(); this.state = State.BEAT_ACTIVE; } } }