public void LoadScript(string _fname) { BackgroundMaster.UnloadBackgrounds(); ScriptCompiler.UnloadCheckpoints(); AudioMaster.UnloadAudio(); VNHandler.UnloadCharacters(); Resources.UnloadUnusedAssets(); currentScript_c = M22.ScriptCompiler.CompileScript(_fname); //M22.ScriptCompiler.CompileScriptAsync(_fname, ref currentScript_c); lineIndex = 0; TEXT.Reset(true); CURRENT_LINE = currentScript_c.GetLine(lineIndex); TEXT.SetNewCurrentLine(CURRENT_LINE.m_lineContents); ExecuteFunction(CURRENT_LINE); }
void Start() { tempSpr = destSpr; img.material.SetTexture("_SecondaryTex", destSpr.texture); img.material.SetTexture("_MainTex", tempSpr.texture); parent = Camera.main.GetComponent <SceneManager>().VNHandler; if (parent == null) { Debug.LogError("Failed to get VNHandler from main camera!"); } if (effect == null) { effect = Resources.Load <Sprite>("March22/Images/white") as Sprite; } img.material.SetTexture("_TertiaryTex", effect.texture); img.material.SetColor("_AmbientLighting", RenderSettings.ambientLight); img.material.SetFloat("_Progress", inc); img.material.SetFloat("_InOrOut", 0); rect.sizeDelta = destSpr.rect.size; StartCoroutine(FadeIn()); }
public ScriptMaster( VNHandler _VNHandlerScript, AudioMaster _AudioMasterScript, Image _TextboxImage, GameObject _DecisionsPrefab, GameObject _TransitionPrefab, GameObject _VideoPlayerPrefab, GameObject _LoopedSFXPrefab ) { VNHandlerScript = _VNHandlerScript; AudioMasterScript = _AudioMasterScript; TextboxIMG = _TextboxImage; DecisionsPrefab = _DecisionsPrefab; TransitionPrefab = _TransitionPrefab; VideoPlayerPrefab = _VideoPlayerPrefab; LoopedSFXPrefab = _LoopedSFXPrefab; this.registeredFunctions = new Dictionary <LINETYPE, InternalFunction>(); this.registerFunctionClass(LINETYPE.GOTO, new M22.Functions.Goto()); this.registerFunctionClass(LINETYPE.DRAW_CHARACTER, new M22.Functions.DrawCharacter()); this.registerFunctionClass(LINETYPE.WAIT, new M22.Functions.Wait()); this.registerFunctionClass(LINETYPE.NEW_PAGE, new M22.Functions.NewPage()); this.registerFunctionClass(LINETYPE.DRAW_BACKGROUND, new M22.Functions.DrawBackground()); this.registerFunctionClass(LINETYPE.SET_FLAG, new M22.Functions.SetFlag()); this.registerFunctionClass(LINETYPE.NARRATIVE, new M22.Functions.Narrative()); this.registerFunctionClass(LINETYPE.DIALOGUE, new M22.Functions.Dialogue()); this.registerFunctionClass(LINETYPE.CLEAR_CHARACTER, new M22.Functions.ClearCharacter()); this.registerFunctionClass(LINETYPE.CLEAR_CHARACTERS, new M22.Functions.ClearCharacters()); this.registerFunctionClass(LINETYPE.STOP_SFX_LOOPED, new M22.Functions.StopSFXLooped()); this.registerFunctionClass(LINETYPE.MOVEMENT_SPEED, new M22.Functions.MovementSpeed()); this.registerFunctionClass(LINETYPE.LOAD_SCRIPT, new M22.Functions.LoadScript()); this.Awake(); this.Start(); }
void Awake() { if (!(camera = this.GetComponent <Camera>())) { throw new System.Exception("[SceneManager] Needs to be attached to a camera."); } this.AddPrefabs(); musicSource = this.gameObject.AddComponent <AudioSource>(); musicSource.bypassEffects = true; musicSource.bypassReverbZones = true; musicSource.loop = true; musicSource.priority = 64; musicSource.outputAudioMixerGroup = this.outputAudioMixer; audioMaster = new AudioMaster(musicSource, this); vnHandler = new VNHandler(CharacterPrefab); scriptMaster = new ScriptMaster( vnHandler, audioMaster, TextboxCanvas.transform.Find("Textbox").GetComponent <Image>(), DecisionsPrefab, TransitionPrefab, VideoPlayerPrefab, LoopedSFXPrefab ); scriptMaster.background = BackgroundCanvas.gameObject.transform.Find("Background").gameObject.GetComponent <Image>(); scriptMaster.backgroundTrans = BackgroundCanvas.gameObject.transform.Find("BackgroundTransition").gameObject.GetComponent <Image>(); scriptMaster.TEXT = TextboxCanvas.gameObject.transform.GetComponentInChildren <TypeWriterScript>(); scriptMaster.TransitionPrefab = this.TransitionPrefab; scriptMaster.DecisionsPrefab = this.DecisionsPrefab; scriptMaster.VideoPlayerPrefab = this.VideoPlayerPrefab; customFunctionality = new CustomFunctionHandler(); }
// Use this for initialization void Start() { SM = Camera.main.GetComponent <ScriptMaster>(); VN = Camera.main.GetComponent <VNHandler>(); }
void Start() { VNHandlerScript = this.gameObject.GetComponent <M22.VNHandler>(); AudioMasterScript = this.gameObject.GetComponent <AudioMaster>(); TextboxIMG = GameObject.Find("Textbox").GetComponent <Image>(); if (TEXT == null) { Debug.Log("TEXT not found in ScriptMaster; falling back to searching..."); TEXT = TextboxIMG.gameObject.GetComponentInChildren <TypeWriterScript>(); if (TEXT == null) { Debug.Log("This also failed! :("); } else { TEXT.SetParent(this); } } else { TEXT.SetParent(this); } if (background == null) { Debug.Log("background not found in ScriptMaster; falling back to searching..."); if (GameObject.Find("Background") != null) { background = GameObject.Find("Background").GetComponent <Image>(); } if (background == null) { Debug.Log("This also failed! :("); } else { backgroundScript = background.gameObject.GetComponent <BackgroundScript>(); } } else { backgroundScript = background.gameObject.GetComponent <BackgroundScript>(); } if (backgroundTrans == null) { Debug.Log("backgroundTrans not found in ScriptMaster; falling back to searching..."); if (GameObject.Find("BackgroundTransition") != null) { backgroundTrans = GameObject.Find("BackgroundTransition").GetComponent <Image>(); } if (backgroundTrans == null) { Debug.Log("This also failed! :("); } else { backgroundTransScript = backgroundTrans.gameObject.GetComponent <BackgroundScript>(); } } else { backgroundTransScript = backgroundTrans.gameObject.GetComponent <BackgroundScript>(); } if (GameObject.Find("BackgroundCanvas") != null) { Canvases.Add(GameObject.Find("BackgroundCanvas").GetComponent <Canvas>()); } if (GameObject.Find("PreCharacterEffectCanvas") != null) { Canvases.Add(GameObject.Find("PreCharacterEffectCanvas").GetComponent <Canvas>()); } if (GameObject.Find("CharacterCanvas") != null) { Canvases.Add(GameObject.Find("CharacterCanvas").GetComponent <Canvas>()); } if (GameObject.Find("PostCharacterEffectCanvas") != null) { Canvases.Add(GameObject.Find("PostCharacterEffectCanvas").GetComponent <Canvas>()); } if (GameObject.Find("TextboxCanvas") != null) { Canvases.Add(GameObject.Find("TextboxCanvas").GetComponent <Canvas>()); } if (GameObject.Find("EffectCanvas") != null) { Canvases.Add(GameObject.Find("EffectCanvas").GetComponent <Canvas>()); } if (TransitionPrefab == null) { Debug.LogError("TransitionPrefab not attached to ScriptMaster! Check this under Main Camera!"); } TransitionEffects = new Dictionary <string, Sprite>(); TransitionEffects.Add("tr_eyes", Resources.Load <Sprite>("Transitions/tr_eyes") as Sprite); TransitionEffects.Add("default", Resources.Load <Sprite>("Images/white") as Sprite); TransitionEffects.Add("tr-pronoise", Resources.Load <Sprite>("Transitions/tr-pronoise") as Sprite); TransitionEffects.Add("tr-clockwipe", Resources.Load <Sprite>("Transitions/tr-clockwipe") as Sprite); TransitionEffects.Add("tr-softwipe", Resources.Load <Sprite>("Transitions/tr-softwipe") as Sprite); TransitionEffects.Add("tr-delayblinds", Resources.Load <Sprite>("Transitions/tr-delayblinds") as Sprite); TransitionEffects.Add("tr-flashback", Resources.Load <Sprite>("Transitions/tr-flashback") as Sprite); if (VideoPlayerPrefab == null) { Debug.LogError("VideoPlayerPrefab not attached to ScriptMaster! Check this under Main Camera!"); } LoopedSFXPrefab = Resources.Load("Prefabs/SFXPrefab") as GameObject; if (LoopedSFXPrefab == null) { Debug.LogError("Failed to load LoopedSFXPrefab! Check \"Resources/Prefabs\" for this!"); } if (TextboxIMG != null) { HideText(); } }
// Use this for initialization void Start() { SM = Camera.main.GetComponent <SceneManager>().ScriptMaster; VN = Camera.main.GetComponent <SceneManager>().VNHandler; }