Пример #1
0
    public void _wm_pushSentenceBitsToMasterController()
    {
        mcRef.resetSentencePiecesList();
        StringBank sb = bank.getNextBank();

        for (int i = 0; i < sb.nItems(); ++i)
        {
            //mcRef.addSentencePiece (rosetta.retrieveString(phrase.getStringId(i)));
            mcRef.addSentencePiece(rosetta.retrieveString(sb.getStringId(i)));
        }
    }
    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();
        }
    }
Пример #3
0
    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;
	}
Пример #4
0
    new void Start()
    {
        rosetta = GameObject.Find("Rosetta").GetComponent <Rosetta> ();
        mcRef   = GameObject.Find("MasterController").GetComponent <MasterControllerScript> ();
        ds      = mcRef.getStorage();

        mcRef.playMusic("QAMusic");

        /* retrieve status from MasterController general storage */

        /*enabled = new bool[qa.Length];
         * for (int i = 0; i < qa.Length; ++i) {
         *
         *      enabled [i] = mcRef.getStorage ().retrieveBoolValue ("QuestionSetIsEnabled" + i);
         *
         * }
         *
         * header = new int[qa.Length];
         * for (int i = 0; i < qa.Length; ++i) {
         *
         *      header [i] = mcRef.getStorage ().retrieveIntValue ("QuestionSetHeader" + i);
         *
         * }*/
        keyChannel = ds.retrieveIntValue("CurrentFlameIndex");
        nLevel     = ds.retrieveIntValue("Level");
        if (nLevel == 0)
        {
            nLevel = 1;
        }
        imageSwitch.setChannel(keyChannel);
        keyImage.GetComponent <Image> ().sprite = imageSwitch.getSprite();

        string sss = obtainTexts.getStringId(keyChannel);

        youGotAKeyText.GetComponent <Text> ().text = rosetta.retrieveString(sss);

        state = QAControllerState.idle;
        questionLetterOutput = 0.0f;
        elapsedTime          = 0.0f;
        answerGO             = new GameObject[maxAnswers];
        currentQuestion      = 0;

        //string curLev = ds.retrieveStringValue ("CurrentLevel");
        //int n = ds.retrieveIntValue (curLev + "NumberOfKeys");
//		int n = ds.retrieveIntValue ("GlobalQACounter");
//		ds.storeIntValue ("GlobalQACounter", n + 1);
//
//		n = FirstSetIndex + (n % (LastSetIndex-FirstSetIndex+1)) - 1;
//
//		bankIndex = n;

        qa = QAHelper.getNextBank();

        qa.reset();
        qb = qa.getNextBank();
        qb.reset();

        nMisses = 0;

        flowerAnim = flower.GetComponent <Animator> ();
        spark1Anim = spark1.GetComponent <Animator> ();
        spark2Anim = spark2.GetComponent <Animator> ();
        spark3Anim = spark3.GetComponent <Animator> ();

        keyImageFader       = keyImage.GetComponent <UIImageFader> ();
        youGotAKeyTextFader = youGotAKeyText.GetComponent <UITextFader> ();

        particles.Stop();
        spark1.transform.localScale = Vector3.zero;
        spark2.transform.localScale = Vector3.zero;
        spark3.transform.localScale = Vector3.zero;
    }