Esempio n. 1
0
    // Use this for initialization
    void Start()
    {
        hrvReceiverScript = GameObject.FindWithTag("MeasureObject").GetComponent <OSCReceiver>();
        respawnLocation   = GameObject.FindWithTag("Player").GetComponent <RespawnScript>();
        pillarRoom        = GameObject.FindWithTag("PillarEvent").GetComponent <PillarRoomEvent>();

        //Torch changing related variables
        torches    = GameObject.FindGameObjectsWithTag("Torch");
        baseTorch  = new Vector4(0.97f, 0.73f, 0.21f, 1);
        dreadTorch = new Vector4(0.49f, 0.02f, 0.11f, 1);
        flameBGM   = GameObject.Find("MazeChanges/FlameChangeBGM").GetComponent <AudioSource>();

        //Wall changing related variables
        crossFadeScript = GetComponent <CrossFade>();

        wallOffset = new Vector2(0f, 0f);
        wallTiling = new Vector2(3f, 1.5f);

        threshWallTiling = new Vector2(-0.19f, 1.5f);          //Brick1
        threshWallOffset = new Vector2(0.6f, 0f);

        smallWallTiling = new Vector2(2f, 1.5f);          //Brick3
        smallWallOffset = new Vector2(0f, 0f);

        tinyWallTiling = new Vector2(1.2f, 1.5f);          //Brick4
        tinyWallOffset = new Vector2(0f, 0f);

        mainWallChange = firstWallChange;
        crossFadeScript.setNewMaterial(secondMaterial, secondSmallWallMaterial, secondTinyWallMaterial, secondThreshMaterial);         //The first set of materials it will change to

        //Enemy range manipulation and such
        //endEnemyRadius = GameObject.Find("End Guardian2/ProximityDetector");
        enemyDetectors = GameObject.FindGameObjectsWithTag("EnemyDetectors");
    }
    // Use this for initialization
    void Start()
    {
        hrvReceiverScript = GameObject.FindWithTag("MeasureObject").GetComponent<OSCReceiver>();
        respawnLocation = GameObject.FindWithTag("Player").GetComponent<RespawnScript>();
        pillarRoom = GameObject.FindWithTag("PillarEvent").GetComponent<PillarRoomEvent>();

        //Torch changing related variables
        torches = GameObject.FindGameObjectsWithTag("Torch");
        baseTorch = new Vector4(0.97f, 0.73f, 0.21f, 1);
        dreadTorch = new Vector4(0.49f, 0.02f, 0.11f, 1);
        flameBGM = GameObject.Find("MazeChanges/FlameChangeBGM").GetComponent<AudioSource>();

        //Wall changing related variables
        crossFadeScript = GetComponent<CrossFade>();

        wallOffset = new Vector2 (0f,0f);
        wallTiling = new Vector2 (3f,1.5f);

        threshWallTiling = new Vector2 (-0.19f, 1.5f); //Brick1
        threshWallOffset = new Vector2 (0.6f,0f);

        smallWallTiling = new Vector2 (2f, 1.5f); //Brick3
        smallWallOffset = new Vector2 (0f,0f);

        tinyWallTiling = new Vector2 (1.2f, 1.5f); //Brick4
        tinyWallOffset = new Vector2 (0f,0f);

        mainWallChange = firstWallChange;
        crossFadeScript.setNewMaterial(secondMaterial, secondSmallWallMaterial, secondTinyWallMaterial, secondThreshMaterial); //The first set of materials it will change to

        //Enemy range manipulation and such
        //endEnemyRadius = GameObject.Find("End Guardian2/ProximityDetector");
        enemyDetectors = GameObject.FindGameObjectsWithTag("EnemyDetectors");
    }
Esempio n. 3
0
    // Update is called once per frame
    void Update()
    {
        if (checkAvgEnv == true)
        {
            if (currAvgEnv > (prevAvgEnv * 1.002f))
            {
                //Torch changes to dreader color
                if (currFlameColor == 0)
                {
                    changeTorches(dreadTorch);
                    randomNum();
                    if (flameSoundPlaying == false && currRand == 1)
                    {
                        flameBGM.Play();
                        flameSoundPlaying = true;
                    }
                    currFlameColor = 1;
                }
                //Walls change as heart rate increases due to being scared.
                //crossFadeScript.crossFadeTo (mainWallChange, wallOffset, wallTiling);
                crossFadeScript.crossFadeTo(mainWallChange, wallOffset, wallTiling, smallWallOffset, smallWallTiling, tinyWallOffset, tinyWallTiling, threshWallOffset, threshWallTiling);

                //Add more enemies (delusions of enemies) in the pillar room based on high HRV
                pillarRoom.enableDelusions();

                //change enemy range radius
                //endEnemyRadius.GetComponent<SphereCollider>().radius = 32f;
                foreach (GameObject enemyRange in enemyDetectors)
                {
                    enemyRange.GetComponent <SphereCollider>().radius = 32f;
                }

                toggleEnvFlags();
            }
            else if (currAvgEnv <= (prevAvgEnv * 1.002f))                 //Should still be *0.something equivalent of high heart rate value
            //torch changes back to normal
            {
                if (currFlameColor == 1)
                {
                    changeTorches(baseTorch);
                    currFlameColor = 0;
                }
                //reset enemy range radius
                //endEnemyRadius.GetComponent<SphereCollider>().radius = 25f;
                foreach (GameObject enemyRange in enemyDetectors)
                {
                    enemyRange.GetComponent <SphereCollider>().radius = 25f;
                }

                toggleEnvFlags();
            }
            else                 //When the value is near the previous average (initially anyways)
            {
                toggleEnvFlags();
            }
        }

        /**envTime += Time.deltaTime;
         *      if (envTime >= 1f) {
         * pillarRoom.enableDelusions();
         * //Debug.Log(floor.terrainData.splatPrototypes[0].texture);
         * //floor.terrainData.splatPrototypes[0].texture = (Texture2D) firstWallChange;
         *
         * //crossFadeScript.crossFadeTo (mainWallChange, wallOffset, wallTiling, smallWallOffset, smallWallTiling, tinyWallOffset, tinyWallTiling, threshWallOffset, threshWallTiling);
         *              envTime = 0f;
         *      }**/

        //Set of code to check player location, and change wall texture and materials accordingly. Also start changing the roof
        //The tricky part: The tiling and offset for the other stuff when they come (if they have different tillings and offsets that is)
        if (crossFadeScript.hasWallsChanged() == true && respawnLocation.passedCheckPoint1 == true && usedSecondChange == false)
        {
            mainWallChange = secondWallChange;
            crossFadeScript.setNewMaterial(thirdMaterial, thirdSmallWallMaterial, thirdTinyWallMaterial, thirdThreshMaterial);
            crossFadeScript.resetWallChanging();
            crossFadeScript.startChangeRoof();
            usedSecondChange = true;
        }
        else if (crossFadeScript.hasWallsChanged() == true && respawnLocation.passedCheckPoint3 == true && usedThirdChange == false)
        {
            mainWallChange = thirdWallChange;
            crossFadeScript.setNewMaterial(fourthMaterial, fourthSmallWallMaterial, fourthTinyWallMaterial, fourthThreshMaterial);
            crossFadeScript.resetWallChanging();
            crossFadeScript.startChangeRoof();
            usedThirdChange = true;
        }
    }