new void Update() { if (!Input.GetMouseButton(0) && !globalCanPick) { canPick = true; } if (isWaitingForActionToComplete) { return; } if (actionState == 0) { isWaitingForActionToComplete = true; } else if (actionState == 1) { string returnToLocation = mcRef.getSavedLocation(); if (!lose) { string currentWell = mcRef.getStorage().retrieveStringValue("CurrentWell"); mcRef.getStorage().storeBoolValue(currentWell, true); int num = mcRef.getStorage().retrieveIntValue("FirstWellDone"); mcRef.getStorage().storeIntValue("FirstWellDone", ++num); } int nWells; nWells = mcRef.getStorage().retrieveIntValue("TotalWells"); mcRef.getStorage().storeIntValue("TotalWells", nWells + 1); mcRef.setVolume(0.0f, 1.5f); mcRef.selectMixer(0); mcRef.playMusic(); mcRef.setVolume(1.0f, 1.5f); SceneManager.LoadScene(returnToLocation); } }
// Update is called once per frame void Update() { debuggg.text = "" + estado + " (" + state + ")"; //mcRef.loadLvl.allowSceneActivation = carga; if (estado == "logo") { elapsedTime += Time.deltaTime; if (elapsedTime > minTime) { if (Input.GetMouseButtonDown(0)) { elapsedTime = delayTime + 1.0f; } } if ((elapsedTime > delayTime) && state == 0) { //fader._wa_fadeOut (this); fRef.fadeOut(); state = 1; } if (!fRef.isFading && state == 1) { estado = "titulo"; grupoLogo.SetActive(false); fRef.fadeIn(); state = 0; } } if (estado == "titulo") { if (state == 0) { if (elapsedTimeTitle < 2.0f) { elapsedTimeTitle += Time.deltaTime; } else { ++state; } } if (state == 1) { heroGlow.glow(); tocaParaEmpezar.SetActive(true); loadingStringBank.rosetta = rosetta; loadingStringBank.reset(); loadingText.text = loadingStringBank.getNextString(); tocaParaEmpezar.GetComponent <TextMesh> ().text = loadingStringBank.getNextString(); //touchToStartText.text = loadingStringBank.getNextString (); // touchToStartText.transform.localScale = Vector3.zero; // touchToStartText.GetComponent<TouchToStart> ().reset (); // touchToStartText.GetComponent<Renderer> ().enabled = true; ++state; } ++count; if (count == 10) { //fRef = fadeRef.GetComponent<FaderScript> (); //fRef.setFadeValue (0.0f); //fRef.fadeIn (); } if (Input.GetMouseButtonDown(0) && !tocaParaEmpezar.GetComponent <TouchToStart>().wait) // if screen touched { fRef.fadeOut(); // start a fadeout beginTime = Time.time; mcRef.setVolume(0, 1.5f); } if ((beginTime > 0.0f) && (Time.time - beginTime) > 2.0) // wait for 2 seconds { vText.enabled = false; uiload.load(); //this.activityFinish (); estado = "cargando"; mcRef.LoadAsync(); contador = 2; } } if (estado == "cargando") { contador -= Time.deltaTime; if (contador <= 0) { this.activityFinish(); } } }
new void Start () { WalkingMode (); SelectHUD (); GameObject inetGO = GameObject.Find ("RedIntercon"); if (inetGO != null) { iNetRef = inetGO.GetComponent<interconNetwork> (); } speed = PLAYERSPEED; GameObject mgo = GameObject.Find ("MirrorObject"); if(mgo != null) { mirrorObject = mgo.GetComponent<MirrorObject> (); } agent = GetComponent<UnityEngine.AI.NavMeshAgent> (); if (agent != null) { agent.enabled = false; agent.updateRotation = false; } r = GetComponent<Rigidbody> (); unblockControls (); cam = GameObject.Find ("CameraLerp").GetComponent<CameraManager> (); masterControllerRef = GameObject.Find ("MasterController"); mcsRef = masterControllerRef.GetComponent<MasterControllerScript> (); rosetta = GameObject.Find ("Rosetta").GetComponent<Rosetta> (); ds = mcsRef.getStorage (); // check music if (!ds.retrieveBoolValue ("Is" + levelRef.locationName + "MusicPlaying")) { mcsRef.selectMixer (0); string lvl = levelRef.locationName.Substring (5, 1); //mcsRef.playMusic (int.Parse(lvl)); mcsRef.setVolume (1.0f); ds.storeBoolValue ("Is" + levelRef.locationName + "MusicPlaying", true); } spawningShadowElapsedTime = noSpawningShadowTime; state2 = PlayerState.idling; interactionQuadRef.GetComponent<SpriteRenderer> ().enabled = false; interaction = Interaction.None; interactee = null; backupInteractee = null; direction = PlayerDirection.front; playerRendRef = spriteQuadRef.GetComponent<SpriteRenderer>(); playerMatRef = playerRendRef.material; otherPlayerRendRef = spriteQuadBehindRef.GetComponent<SpriteRenderer> (); otherPlayerMat = otherPlayerRendRef.material; ascendPos = 0.0f; ascendSpeed = 0.0f; ascendAccel = 45.0f; elapsedTime = 0.0f; if (ds.retrieveBoolValue ("PlayerMustMaterialize")) { state = PlayerState.dematerialized; playerMatRef.color = new Color (1, 1, 1, 0); blocked = true; } else { state = PlayerState.idling; //opacity = 1.0f; playerMatRef.color = new Color (1, 1, 1, 1); } float x, y, z; x = ds.retrieveFloatValue ("Coords" + levelRef.locationName + "X"); y = ds.retrieveFloatValue ("Coords" + levelRef.locationName + "Y"); z = ds.retrieveFloatValue ("Coords" + levelRef.locationName + "Z"); Debug.Log ("<color=red>Player coords retrieved: (" + x + "," + y + "," + z + ") on "+levelRef.locationName+" </color>"); int orientation; orientation = ds.retrieveIntValue ("Orientation"); Debug.Log ("<color=green>Player orient. stored: (" + orientation + ") on "+levelRef.locationName+"</color>"); setOrientation (orientation); if ((x == 0) && (y == 0) && (z == 0)) { if (GameObject.Find ("PlayerStart")) { Vector3 newPos = GameObject.Find ("PlayerStart").transform.position; this.transform.position = newPos; } mustSnapToPlayerStart = 60; } if ((x != 0.0f) && (y != 0.0f) && (z != 0.0f)) { Vector3 newPos = new Vector3 (x, y, z); this.transform.position = newPos; mustSnapToPlayerStart = 0; } levelRef.loadPhysicalCameraPosition (); cam.Initialize (); string nameOfFollowingCharacter = ds.retrieveStringValue ("FollowingChar"); if (!nameOfFollowingCharacter.Equals ("")) { GameObject charaGO = GameObject.Find (nameOfFollowingCharacter); if (charaGO != null) { float xc = ds.retrieveFloatValue ("FollowerRelativeCoordsX"); float xy = ds.retrieveFloatValue ("FollowerRelativeCoordsY"); float xz = ds.retrieveFloatValue ("FollowerRelativeCoordsZ"); CharacterGenerator chara = charaGO.GetComponent<CharacterGenerator> (); if (chara != null) { chara.warpToRelativeToPlayer (new Vector3 (xc, xy, xz)); chara.setAutopilotAbsolute (true); chara.preventAwake = true; chara.stopAllEvents (); chara.startFollowingPlayer (); chara.markedAsStartFollowing = true; } } } levelRef.Start (); string retAct = ds.retrieveStringValue ("ReturnFromActivity"); if (retAct.Equals ("Well")) { int res = ds.retrieveIntValue ("ActivityResult"); if (res > 0) { int red = ds.retrieveIntValue ("RedManaObtained"); int blue = ds.retrieveIntValue ("BlueManaObtained"); if (red > 0) { string msg = rosetta.retrieveString (recoveryStrings.getStringId (0)) + red; levelRef._wm_alert (msg); } else { //string msg = rosetta.retrieveString (recoveryStrings.getStringId (1)) + blue; string s1 = recoveryStrings.getStringId (1); string s2 = rosetta.retrieveString (s1); string s3 = s2 + blue; levelRef._wm_alert (s3); } } else { //levelRef._wm_alert (rosetta.retrieveString (recoveryStrings.getStringId (2))); string s1 = recoveryStrings.getStringId (2); string s2 = rosetta.retrieveString (s1); levelRef._wm_alert (s2); } } else if (retAct.Equals ("Main-1")) { string lvl = levelRef.locationName.Substring (0, 6); ds.storeIntValue (lvl + "SpawnedShadows", 0); } if (levelRef.floor == 0) ds.storeStringValue ("ReturnFromActivity", "Main"); else if (levelRef.floor == -1) ds.storeStringValue ("ReturnFromActivity", "Main-1"); else if (levelRef.floor == 1) ds.storeStringValue ("ReturnFromActivity", "Main+1"); height = this.transform.position.y - 6; externalForce = Vector3.zero; mcsRef.saveGame (false); // save every time the player is spawned (change location) /* * * Check reentrancy * */ string reentryCondition = ds.retrieveStringValue ("ReentryCondition"); if (reentryCondition.Equals ("MirrorActivation")) { mirrorActivationDelaying = true; //camRef.GetComponent<CameraLookAt> ().enabled = false; cam._wm_disableLookAt (); } else mirrorActivationDelaying = false; if (reentryCondition.Equals ("Inventory")) { ds.storeStringValue ("ReentryCondition", ""); // consume condition int _num = ds.retrieveIntValue ("InventoryLevel"); inventory.reenter (_num); } if(levelRef.retrieveBoolValue("Meditating")) { levelRef.storeBoolValue("Meditating", false); meditatingRemaining = 4.5f; playerRendRef.sprite = Meditating[0]; otherPlayerRendRef.sprite = Meditating[0]; } else { meditatingRemaining = 0.0f; } /* * * Reset reentry condition * */ started = true; }
public void musicFadeOut() { mcRef.setVolume(0.0f, 0.3f); }