private void OnTriggerEnter(Collider other) { mc.unPickUpObject(ObjectToUnpick); }
new public void Start() { if (started) { return; } started = true; GameObject hud = GameObject.FindGameObjectWithTag("HUD"); if (hud != null) { dialogueController = hud.GetComponentInChildren <DialogueObject> (); alertController = hud.GetComponentInChildren <alertImageController> (); fader = hud.GetComponentInChildren <UIFaderScript> (); SetFaderColor(); vignette = hud.GetComponentInChildren <VignetteScript> (); } Application.targetFrameRate = 30; mcRef.changeLocation(locationName); if (locationName.StartsWith("Level")) { Debug.Log("<color=purple>Storing CurrentLevel : " + locationName.Substring(0, 6) + "</color>"); ds.storeStringValue("CurrentLevel", locationName.Substring(0, 6)); } if (locationName.StartsWith("Level")) { string lvl = locationName.Substring(5, 1); mcRef.getStorage().storeBoolValue("HasVisitedWorld" + lvl, true); } plyr = GameObject.Find("Player"); //GameObject hud = null; if (plyr != null) { hud = plyr.GetComponent <PlayerScript>().currentHUD; //GameObject.FindGameObjectWithTag ("HUD"); } if (hud != null) { dialogueController = hud.GetComponentInChildren <DialogueObject> (); alertController = hud.GetComponentInChildren <alertImageController> (); fader = hud.GetComponentInChildren <UIFaderScript> (); vignette = hud.GetComponentInChildren <VignetteScript> (); SetFaderColor(); } string objectToDestroy; // take care of flame re-spawning into the level int flameCount; string lvlname = SceneManager.GetActiveScene().name; for (int k = 0; k < MaxFlames; ++k) { flameCount = mcRef.getStorage().retrieveIntValue("Flame" + k + "Resurrect" + lvlname); if (flameCount > 0) { --flameCount; if (flameCount == 0) { string flamename = mcRef.getStorage().retrieveStringValue("Flame" + k + "Resurrect" + lvlname); mcRef.unPickUpObject(flamename); } mcRef.getStorage().storeIntValue("Flame" + k + "Resurrect" + lvlname, flameCount); } } /* destroy all objects that have already been picked up * on this location */ objectToDestroy = mcRef.nextPickedUpObject(); while (!objectToDestroy.Equals("")) { Debug.Log("<color=red> -> Pick up destroying " + objectToDestroy + "</color>"); Destroy(GameObject.Find(objectToDestroy)); objectToDestroy = mcRef.nextPickedUpObject(); } if (mcRef.hasCurrentLocationBeenVisited()) { //plyr.transform.position = mcRef.getPlayerSpawnLocation (); } if (openVignette) { //vignette.setVignetteScale (0.0f); if (vignette != null) { bool inhibit = retrieveBoolValue("InhibitVignette"); if (!inhibit) { vignette._wm_open(); } else { if (ds.retrieveBoolValue("FadeWhite")) { ds.storeBoolValue("FadeWhite", false); foreach (UIFaderScript fullScreenFader in fullScreenFaders) { fullScreenFader.setFadeColor(1.0f, 1.0f, 1.0f); fullScreenFader.autoFadeIn = true; fullScreenFader.setFadeValue(0.0f); fullScreenFader.fadeIn(); } } else { fader.autoFadeIn = false; fader.preventAutoFader(); fader.setFadeValue(1.0f); foreach (UIFaderScript fullScreenFader in fullScreenFaders) { fullScreenFader.setFadeValue(1.0f); fullScreenFader.autoFadeIn = false; } } } storeBoolValue("InhibitVignette", false); } } if (alertController != null) { alertController._wm_reset(); } if (!BGMusic.Equals("")) { mcRef.playMusic(BGMusic); } }