public void enable() { state = WhirlpoolState.enabled; spinSpeed = minSpinSpeed; spinAccel = 0.0f; level.storeBoolValue(reentryVariable, true); }
new void Update() { if (player == null) { player = GameObject.Find("Player").GetComponent <PlayerScript> (); } float minDistance = 10000000.0f; int closestMirrorIndex = 0; if (player == null) { return; } /* get index of mirror closest to player */ int nMirrors = mirror.Length; for (int i = 0; i < nMirrors; ++i) { float distance = (mirror [i].transform.position - player.transform.position).magnitude; if (distance < minDistance) { minDistance = distance; closestMirrorIndex = i; } } mat.SetColor("_TintColor", mirrorColor [closestMirrorIndex]); if (mirroredPlayer != null) { mirroredPlayer.mirror = mirrorSurface [closestMirrorIndex]; } if (mustActivateStargates) { elapsedTime += Time.deltaTime; if (elapsedTime > StargateActivationDelay) { for (int i = 0; i < Stargates.Length; ++i) { Stargates [i].activate(); } mustActivateStargates = false; for (int i = 0; i < newLevels.Length; i++) { level.storeBoolValue("Level" + newLevels[i] + "StargateActivated", true); } } } /*Transform[] t = mirroredPlayer.mirror = mirror [closestMirrorIndex].GetComponentsInChildren<Transform>(); * for (int i = 0; i < t.Length; ++i) { * if (t [i].gameObject.name.Equals ("Point light")) { * ((Light)(t [i].gameObject)).color = mirrorColor [closestMirrorIndex]; * } * }*/ }
public void _wm_enable() { if (reentrant) { level.storeBoolValue("is" + this.name + "Enabled", true); } enabled = true; }
public void _wm_enable() { sr.enabled = true; if (reentrant) { level.storeBoolValue(this.name + "IsDisabled", false); } }
public void _wm_rotate() { angle.setValue(finalAngle); atFinalAngle = true; if (reentrant) { lvl.storeBoolValue(this.name + "Rotated", true); } }
public void _wm_enable() { isEnabled = true; if (reentrant) { level.storeBoolValue(this.name + "EnabledSet", true); level.storeBoolValue(this.name + "Enabled", true); } }
public void _wm_open() { level.storeBoolValue("Is" + this.name + "Open", true); targetAngle = openAngle; if (openSound != null) { level.playSound(openSound); } }
public void activate() { level.storeBoolValue(level.locationName + "StargateActivated", true); if (OtherLocationKeyActivate != "") { level.storeBoolValue(OtherLocationKeyActivate + "StargateActivated", true); } swirl.SetActive(true); particles.Play(); Teleporter.SetActive(true); }
public void open() { if ((level != null) && (sound != null)) { level.playSound(sound); } targetAngle = openAngle; if (level == null) { level = GameObject.Find("LevelController").GetComponent <LevelControllerScript> (); } level.storeBoolValue(this.name, true); }
public void open() { targetDisplacement = openDisplacement; if ((level != null) && (closeSound != null)) { if (state == 0) { level.playSound(openSound, this.gameObject); } } state = 1; if (reentrant) { level.storeBoolValue(this.name + "Open", true); } }
public void _wm_selectAnswers() { string key = character + "SuperAnswer"; string lKey = character + "SuperAnswerLevel"; int lastAnswer = level.retrieveIntValue(key); int answerLevel = level.retrieveIntValue(lKey); List <bool> answerEnabled = new List <bool> (); dialogue.resetAnswers(); answerEnabled.Add(true); // we add an extra true so that indexes fall in [1 .. totalAnswers] for (int i = 0; i < totalAnswers; ++i) { answerEnabled.Add(true); } // disable all previously chosen answers disabledAnswers = 0; int answerChosen = level.retrieveIntValue(key + disabledAnswers); while (answerChosen != 0) { dialogue.disableAnswer(answerChosen); answerEnabled [answerChosen] = false; ++disabledAnswers; answerChosen = level.retrieveIntValue(key + disabledAnswers); } // disable the answer we have just chosed if (lastAnswer != 0) { dialogue.disableAnswer(lastAnswer); answerEnabled [lastAnswer] = false; level.storeIntValue(key + disabledAnswers, lastAnswer); ++disabledAnswers; } if ((totalAnswers - 1) == disabledAnswers) { level.storeBoolValue(key + "Depleted", true); } int k = totalAnswers; // keep disabling answers until at most two remain while ((totalAnswers - disabledAnswers) > 2) { if (answerEnabled [k]) { dialogue.disableAnswer(k); answerEnabled [k] = false; ++disabledAnswers; } --k; } }
public override void effect() { player._wa_autopilotTo(this, this.transform.position.x - 0.0f, this.transform.position.y - 0.0f, this.transform.position.z - 5.0f); //hGlow.glow (); autopilotState = PlayerAutopilotState.seeking1; string lvl = level.locationName.Substring(0, 6); level.storeBoolValue("Has" + lvl + MirrorColor + "Energy", false); }
void OnTriggerEnter(Collider other) { if (other.tag == "Player") { fader.setFadeColor(1, 1, 1); fader._wa_fadeOut(this); this.isWaitingForActionToComplete = true; level.storeBoolValue("IsChangingPlanes", true); exit = true; } }
public void _wm_immediatelyOpen() { level.storeBoolValue("Is" + this.name + "Open", true); isOpen = true; angle = targetAngle = openAngle; switch (axis) { case DoorAxis.x: this.transform.localRotation = Quaternion.Euler(angle, 0, 0); break; case DoorAxis.y: this.transform.localRotation = Quaternion.Euler(0, angle, 0); break; case DoorAxis.z: this.transform.localRotation = Quaternion.Euler(0, 0, angle); break; } }
public void _wm_elevate() { targetY = topY; if ((level != null) && (elevateClip != null)) { level.playSound(elevateClip); } if (level != null) { level.storeBoolValue(reentryVariable, true); } }
// Use this for initialization void Start() { level = GameObject.Find("LevelController").GetComponent <LevelControllerScript> (); bool d1 = level.retrieveBoolValue("HasFerfufloDice1"); bool d2 = level.retrieveBoolValue("HasFerfufloDice2"); bool d3 = level.retrieveBoolValue("HasFerfufloDice3"); if (d1 && d2 && d3) { level.storeBoolValue("HasAllFerfufloDice", true); } }
new void Update() { if (state == 0) { if (!isWaitingForActionToComplete) { level.storeBoolValue("PlayerMustMaterialize", true); level.storeStringValue("ReturnLocation", targetWorld); level.loadScene("TransWorldTunnel"); } } }
public void _wm_spawnNoAnswerQuestion(int dropNum) { level.storeBoolValue("PickedUpDroplet" + dropNum, true); ++usedQuestions; int drplt = level.retrieveIntValue("Droplets"); level.storeIntValue("Droplets", drplt + 1); dropletAlive[dropNum - 1] = false; Vector3 playerPos = level.player.transform.position; playerPos.y += 2.5f; GameObject newNAQGO = (GameObject)Instantiate(noAnswerQuestionPrefab, playerPos + new Vector3(-1, 0.3f, -1.3f), Quaternion.Euler(50.0f, 0, 0)); NoAnswerQuestion newNAQ = newNAQGO.GetComponent <NoAnswerQuestion> (); string nextStr = currentStringBank.getStringId(drplt); nextStr = level.rosetta.retrieveString(nextStr); newNAQ.initialize(); newNAQ.transform.localScale = 0.2f * Vector2.one; newNAQ.setText(StringUtils.chopLines(nextStr, 25)); newNAQ.setAutoTransitionOut(3.0f + nextStr.Length * 0.05f); newNAQ.transitionIn(); if (usedQuestions == actualNumberOfDroplets) { level.storeBoolValue(whirlpoolName, true); //if (level.retrieveBoolValue ("HasAlphabet")) { wpool.enable(); //} } if (usedQuestions <= floater.Length) { floater [usedQuestions - 1].Break(); } }
void OnTriggerEnter(Collider other) { if (other.tag == "Player") { if (dataType == DataType.Bool) { levelController.storeBoolValue(variableName, boolValue); } if (dataType == DataType.String) { levelController.storeStringValue(variableName, stringValue); } if (dataType == DataType.Int) { levelController.storeIntValue(variableName, intValue); } if (dataType == DataType.Float) { levelController.storeFloatValue(variableName, floatValue); } } }
public void _wm_checkFerfufloAccess() { level.blockPlayerControls(); int correct = level.retrieveIntValue("FerfufloCorrect"); int completed = level.retrieveIntValue("FerfufloCompleted"); Debug.Log("Correct answers: " + correct); Debug.Log("Completed answers: " + completed); if (correct >= numberOfFerfufloTests) { level.playSound(openSound); level.player.blockControls(); level.storeBoolValue("FerfuflosDone", true); level._wm_alert("Puerta abierta"); state = 1; } else { if (completed >= numberOfFerfufloTests) { level.playSound(noOpenSound); level.player.blockControls(); level._wm_alert("El código configurado en las tarjetas no es válido. Como medida de seguridad, se han reiniciado las tarjetas."); state = 2; } else { percent = (int)(((float)level.retrieveIntValue("FerfufloCompleted") / 41.0f) * 100.0f); percent = percent > 100 ? 100 : percent; level.player.blockControls(); level.playSound(noOpenSound); state = 3; } } }
public void _wm_toggleAccomplishment(int position) { accomplished [position] = !accomplished [position]; lvl.storeBoolValue(this.name + "Accomplised" + position, accomplished[position]); bool allDone = true; foreach (bool c in accomplished) { if (c == false) { allDone = false; break; } } if (allDone) { //fakePanel._wm_open (); //direction._wm_enable(); //inclination._wm_enable(); //player.blocked = true; //cameraSwitch._wm_switchToCameraName("L3VerdeSecretCamera"); AllDoneProgram.startProgram(0); } }
public void _wm_go() { colliderBarrier.SetActive(true); level.storeBoolValue(this.name + "Init", true); lightIntensity = 16 + 8 * (energyRods.Length - solvedRods); if (energyRods.Length == solvedRods) { lightIntensity = 0; colliderBarrier.SetActive(false); } else { foreach (SoftMover sm in energyRings) { sm.gameObject.SetActive(true); } } foreach (SoftMover sm in energyRods) { sm._wm_move(); } updateLightIntensity(); }
/* methods */ // Use this for initialization void Start() { if (level == null) { level = GameObject.Find("LevelController").GetComponent <LevelControllerScript> (); } bool alphabetInitialized = level.retrieveBoolValue("AlphabetInitialized"); if (!alphabetInitialized) { letterNum = nLetters / 2; step = (substeps / 2) - 1; int gs = letterNum * substeps + step; level.storeIntValue("AlphabetGlobalStep", gs); level.storeBoolValue("AlphabetInitialized", true); } else { globalStep = level.retrieveIntValue("AlphabetGlobalStep"); letterNum = globalStep / substeps; step = globalStep % substeps; } targetGlobalOpacity = globalOpacity = 0.0f; idleElapsedTime = 0.0f; state = LetterState.idle; state2 = 0; slot1elapsedTime = 0.0f; if (letterToDisplay >= letter.Length) { letterToDisplay = 0; } letter1.color = new Color(1, 1, 1, 1); letter2.color = new Color(1, 1, 1, 0); letter1color = 1.0f; letter2opacity = 0.0f; letter1.texture = letter [letterToDisplay]; step = (substeps / 2) - 1; lettersToDec = 0; targetLetterNum = letterNum; globalStep = letterNum * substeps + (substeps / 2) - 1; globalTargetStep = globalStep; maxGlobalStep = nLetters * substeps - 1; letter1.texture = letter [letterNum]; letter2.texture = litLetter [letterNum]; // consume reward int reward = level.retrieveIntValue("AlphabetReward"); if (reward > 0) { addStep(reward); } else { subStep(-reward); } level.storeIntValue("AlphabetReward", 0); if (reward != 0) { level.storeIntValue("AlphabetGlobalStep", globalTargetStep); } }
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; }
// Use this for initialization void Start() { level.storeBoolValue(VariableNombre, false); }
public void _wm_baja() { y.setValue(finalY); levelController.storeBoolValue(StorageVariable, true); }