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;
        }
    }
Ejemplo n.º 2
0
    public int calculatePercetage()
    {
        int percent = (int)(((float)level.retrieveIntValue("FerfufloCompleted") / 41.0f) * 100.0f);

        percent = percent > 100 ? 100 : percent;
        return(percent);
    }
Ejemplo n.º 3
0
    public void OnTriggerEnter(Collider other)
    {
        if (state == WhirlpoolState.disabled)
        {
            return;
        }

        if (requireAlphabet && (!level.retrieveBoolValue("HasAlphabet")))
        {
            return;
        }

        if (other.tag == "Player")
        {
            other.gameObject.GetComponent <PlayerScript> ().land();
            other.gameObject.GetComponent <PlayerScript> ().spin(this);
            this.isWaitingForActionToComplete = true;
            state = WhirlpoolState.finishing;
            if (!heavenVariableName.Equals(""))
            {
                // reset reentry related global variables
                level.storeIntValue(heavenVariableName, level.retrieveIntValue(heavenVariableName) + 1);
                level.storeBoolValue("Droplets", false);
                level.storeIntValue("Droplets", 0);
                for (int i = 0; i <= 6; ++i)
                {
                    level.storeBoolValue("PickedUpDroplet" + i, false);
                }
                level.storeBoolValue("HeaveSpeak", false);
                level.storeBoolValue("SignGameReentry", false);
            }
        }
    }
Ejemplo n.º 4
0
 void Start()
 {
     level = GameObject.Find("LevelController").GetComponent <LevelControllerScript> ();
     if (reentrant)
     {
         curChannel = level.retrieveIntValue("TVChannel" + screenId);
     }
     _wm_switchChannel(curChannel);
 }
Ejemplo n.º 5
0
    public bool _wm_allWavesDone()
    {
        string lvl        = level.locationName.Substring(0, 6);
        int    waveNumber = level.retrieveIntValue(lvl + "ShadowWaveNumber");

        if (waveNumber > shadowSpawnController.waveType.Length)
        {
            return(true);
        }
        return(false);
    }
Ejemplo n.º 6
0
 // Use this for initialization
 void Start()
 {
     level         = GameObject.Find("LevelController").GetComponent <LevelControllerScript> ();
     currentAmount = level.retrieveIntValue("TVFerfuflosTimes" + id);
     if (currentAmount == amount)
     {
         tvChannelSwitch._wm_switchChannel(1);
         level.storeIntValue("TVFerfuflosClearFirstTime", 1);
     }
     _wm_storeTVid();
     alert = GameObject.Find("AlertImage").GetComponent <alertImageController> ();
 }
Ejemplo n.º 7
0
    void Start()
    {
        for (int i = 0; i < magos.Length; i++)
        {
            magos [i].SetActive(false);
        }

        lvl = GameObject.Find("LevelController").GetComponent <LevelControllerScript> ();

        numMago = lvl.retrieveIntValue("MagoElegido");

        magos [numMago].SetActive(true);
    }
    // Start is called before the first frame update
    void Start()
    {
        LevelControllerScript level = FindObjectOfType <LevelControllerScript>();

        if (level != null)
        {
            int value = level.retrieveIntValue(VarName);
            if (value > 0)
            {
                Destroy(this.gameObject);
            }
        }
    }
Ejemplo n.º 9
0
 void OnTriggerEnter(Collider other)
 {
     if (RecoilRemain > 0.0f)
     {
         return;
     }
     if (!enabled)
     {
         return;
     }
     if (other.tag == "Player")
     {
         int FootstepLevel = lvl.retrieveIntValue("FootstepTriggerLevel");
         ++FootstepLevel;
         lvl.storeIntValue("FootstepTriggerLevel", FootstepLevel);
         Debug.Log("FSTLevel: " + FootstepLevel);
         if (!groundType.Equals(""))
         {
             Debug.Log("Setting sound: " + groundType);
             footsoundMgr.setGroundType(groundType);
         }
     }
 }
    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;
            }
        }
    }
Ejemplo n.º 11
0
    public void refresh()
    {
        //if (coco) {
        selected = level.retrieveIntValue(retrieveVariable);
        for (int i = 0; i < duendeCoco.Length; ++i)
        {
            if (duendeCoco [i] != null)
            {
                if ((selected - 1) == i)
                {
                    duendeCoco [i].interactEnabled = false;
                }
            }
        }
        //} else {

        //}
    }
Ejemplo n.º 12
0
    void Start()
    {
        if (level == null)
        {
            level = GameObject.Find("LevelController").GetComponent <LevelControllerScript> ();
        }

        usedPosition = new List <bool> ();
        for (int i = 0; i < position.Length; ++i)
        {
            usedPosition.Add(false);
        }
        int n = level.retrieveIntValue(heavenVariableName);

        //Random.seed = n;
        Random.InitState(n);
        distribute();
    }
    void Start()
    {
        level        = GameObject.Find("LevelController").GetComponent <LevelControllerScript> ();
        nOfSlices    = slice.Length;
        advanceSlice = 2;
        retreatSlice = 0;

        int sliceToMove;

        actualSlice = level.retrieveIntValue(SliceControllerName + "slice");
        // take controller to previously stored state
        for (int i = 0; i < actualSlice; ++i)
        {
            sliceToMove = ((2 + i) + nOfSlices - 2) % nOfSlices;           // equivalent to (advanceSlice - 1) % nOfSlices
            moveSlice(sliceToMove, true);
            advanceSlice = (advanceSlice + 1) % nOfSlices;
            retreatSlice = (retreatSlice + 1) % nOfSlices;
        }
    }
Ejemplo n.º 14
0
    // Use this for initialization
    void Start()
    {
        level = GameObject.Find("LevelController").GetComponent <LevelControllerScript> ();

        foreach (ActivatorChannel c in channels)
        {
            int status = level.retrieveIntValue(c.theObject.name + "isActive");
            if (status == 0)
            {
                c.theObject.SetActive(c.startActive);
            }
            else if (status == 1)
            {
                c.theObject.SetActive(true);
            }
            else
            {
                c.theObject.SetActive(false);
            }
        }
    }
Ejemplo n.º 15
0
    const float timeOut   = 5.0f;   // 5 seconds max!

    new void Start()
    {
        shadowList = new List <Shadow> ();
        state      = 0;

        waveIndexes = new int[waveType.Length];

        master = GameObject.Find("MasterController").GetComponent <MasterControllerScript> ();
        ds     = master.getStorage();

        camera   = GameObject.Find("CameraLerp").GetComponent <CameraManager> ();
        levelRef = GameObject.Find("LevelController").GetComponent <LevelControllerScript> ();
        level    = levelRef.locationName.Substring(0, 6);

        string lvl      = levelRef.locationName.Substring(0, 6);
        string key      = lvl + "SpawnedShadows";
        int    nShadows = levelRef.retrieveIntValue(key);

        for (int i = 0; i < nShadows; ++i)
        {
            //spawn shadows here
            Debug.Log("<color=red>Should spawn " + nShadows + " shadows</color>");
        }

        waveNumber = ds.retrieveIntValue(level + "ShadowWaveNumber");
        if (waveNumber > waveType.Length)
        {         // already cleared
            mirror.deplete();
        }

        else if (waveNumber == 0)           // first time here

        // randomize order of waves
        {
            List <int> selectedIntegers = new List <int> ();
            for (int i = 0; i < waveType.Length; ++i)
            {
                int rand = Random.Range(0, waveType.Length);
                while (selectedIntegers.Contains(rand))
                {
                    rand = Random.Range(0, waveType.Length);
                }
                selectedIntegers.Add(rand);
                waveIndexes [i] = rand;
                ds.storeIntValue(level + "ShadowWaveIndex" + i, rand);
            }

            waveNumber = 1;
            ds.storeIntValue(level + "ShadowWaveNumber", 1);
        }
        else
        {
            for (int i = 0; i < waveType.Length; ++i)
            {
                waveIndexes [i] = ds.retrieveIntValue(level + "ShadowWaveIndex" + i);
            }
        }

        ds.storeStringValue("WordFightRequiredWisdom", waveType[waveIndexes[waveNumber - 1]]);

        control  = Random.Range(minControl, minControl + csRange);
        strength = Random.Range(minStrength, minStrength + csRange);

        /*
         * int reentryShadows = ds.retrieveIntValue ("ReentryShadows");
         * for (int i = 0; i < reentryShadows; ++i) {
         *      float x, y, z;
         *      x = ds.retrieveFloatValue ("Shadow"+i+"Coords" + levelRef.locationName + "X");
         *      y = ds.retrieveFloatValue ("Shadow"+i+"Coords" + levelRef.locationName + "Y");
         *      z = ds.retrieveFloatValue ("Shadow"+i+"Coords" + levelRef.locationName + "Z");
         *      int orientation;
         *      orientation = ds.retrieveIntValue ("Shadow"+i+"Orientation");
         *      //setOrientation (orientation);
         *      if ((x != 0.0f) && (y != 0.0f) && (z != 0.0f)) {
         *              Vector3 newPos = new Vector3 (x, y, z);
         *              this.transform.position = newPos;
         *      }
         * }*/
    }
Ejemplo n.º 16
0
    public void setEnableLevel0(bool en)
    {
        canvas1.enabled = en;
        bool b = levelRef.retrieveBoolValue("HasAlphabet");

        alphabet.enabled    = (en && b);
        powerCircle.enabled = en;
        backpack.enabled    = en;
        back0.enabled       = en;

        if (en && b)
        {
            bool alphabetInit = levelRef.retrieveBoolValue("AlphabetInitialized");
            if (alphabetInit)
            {
                int gs = levelRef.retrieveIntValue("AlphabetGlobalStep");
                alphabetLetter.texture = letter [gs / Letter.substeps];
                alphabetLetter.enabled = true;
            }
            else
            {
                alphabetLetter.enabled = false;
            }
        }
        else
        {
            alphabetLetter.enabled = false;
        }
    }
Ejemplo n.º 17
0
    /* 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);
        }
    }
Ejemplo n.º 18
0
    new void Start()
    {
        if (level == null)
        {
            level = GameObject.Find("LevelController").GetComponent <LevelControllerScript> ();
        }

        dropletAlive = new List <bool> ();
        visitNumber  = level.retrieveIntValue(variableName);

        visitNumber = (visitNumber % stringBanks.bank.Length);

        currentStringBank = stringBanks.bank [visitNumber];

        actualNumberOfDroplets = currentStringBank.nItems();

        for (int i = 0; i < actualNumberOfDroplets; ++i)
        {
            dropletAlive.Add(true);
        }
        for (int i = actualNumberOfDroplets; i < waterDroplets.Length; ++i)
        {
            dropletAlive.Add(false);
        }

        for (int i = actualNumberOfDroplets; i < waterDroplets.Length; ++i)
        {
            //Destroy (waterDroplets [i]); // get rid of unused droplets
            waterDroplets[i].SetActive(false);
        }

        currentStringBank.rosetta = level.rosetta;
        currentStringBank.reset();

        for (int i = 0; i < waterDroplets.Length; ++i)
        {
            bool b = level.retrieveBoolValue("PickedUpDroplet" + (i + 1));
            if (b)
            {
                dropletAlive [i] = false;
            }
        }

        int nFloaters;

        nFloaters = currentStringBank.nItems();
        floater   = new HeavyLevitatingFollower[nFloaters];

        int pickedUpDroplets = level.retrieveIntValue("Droplets");

        for (int i = 0; i < nFloaters; ++i)
        {
            Vector3 newPos = level.player.transform.position - Vector3.right * 100;
            newPos.x -= 5 * i;
            GameObject newFloater = (GameObject)Instantiate(floaterPrefab, newPos, Quaternion.Euler(0, 0, 0));
            floater [i]            = newFloater.GetComponent <HeavyLevitatingFollower> ();
            floater [i].player     = level.player;
            floater [i].nearRadius = 2.0f + i * 2.0f;
            floater [i].initialize();
            floater [i].yOffset = followerYOffset;
            if (i < pickedUpDroplets)
            {
                floater [i].immediateBreak();
            }
        }
        usedQuestions = pickedUpDroplets;
    }
Ejemplo n.º 19
0
 private void Start()
 {
     level = FindObjectOfType <LevelControllerScript>();
     state = level.retrieveIntValue("Seq" + this.name + "State");
 }
 // Use this for initialization
 void Start()
 {
     level      = GameObject.Find("LevelController").GetComponent <LevelControllerScript> ();
     solvedRods = level.retrieveIntValue(this.name + "SolvedRods");
     _wm_reset();
 }
Ejemplo n.º 21
0
    void Update()
    {
        if (freezer.frozen)
        {
            return;
        }

        if (!frozen)
        {
            elapsedTime += Time.deltaTime;
        }

        /* busy: spawning whilwinds */
        if (state == InterconNetworkState.busy)
        {         // pursuing player
            elapsedVeeringTime += Time.deltaTime;
            if (elapsedVeeringTime > timeToVeer)
            {
                elapsedVeeringTime = 0.0f;
                //int r = Random.Range (0, 100);

                Vector3 pPos  = player.transform.position;
                Vector3 tPos  = this.transform.position;
                Vector3 delta = pPos - tPos;
                delta.Normalize();
                targetAngle = Mathf.Acos(delta.x);
                if (delta.z < 0.0)
                {
                    targetAngle = (2.0f * 3.1416f) - targetAngle;
                }

                linearSpeed = floatRandomRange(minLinearSpeed, maxLinearSpeed);

                Debug.Log("<color=orange>Target Angle updated: " + targetAngle + "</color>");
            }

            if (elapsedTime > timeToWhirl)
            {
                elapsedTime = 0.0f;
                GameObject newWhirl = (GameObject)Instantiate(whirlwindPrefab, this.transform.position, Quaternion.Euler(0, 0, 0));
                newWhirl.name = "Whirlwind";
                newWhirl.GetComponent <Whirlwind> ().thoughtTextPrefab = thoughtTextPrefab;
                newWhirl.GetComponent <Whirlwind> ().parent            = this;
                newWhirl.GetComponent <Whirlwind> ().shadowPrefab      = shadowPrefab;
                newWhirl.GetComponent <Whirlwind> ().rosetta           = rosetta;
                newWhirl.GetComponent <Whirlwind> ().FamilyIcon        = FamilyIcon;
                newWhirl.GetComponent <Whirlwind> ().CoupleIcon        = CoupleIcon;
                newWhirl.GetComponent <Whirlwind> ().FriendsIcon       = FriendsIcon;
                //newWhirl.GetComponent<Whirlpool> ().Start ();
                newWhirl.GetComponent <Whirlwind> ().WorkIcon = WorkIcon;
                int wave = shadowSpawnController.getWaveIndex();

                newWhirl.GetComponent <Whirlwind> ().shadowStringBanks     = HeroShadows[wave];
                newWhirl.GetComponent <Whirlwind> ().redEyesStringBanks    = HeroRedeyes[wave];
                newWhirl.GetComponent <Whirlwind> ().shadowSpawnController = shadowSpawnController;
                newWhirl.GetComponent <Whirlwind> ().placesStringBank      = places;
                newWhirl.GetComponent <Whirlwind> ().datesStringBank       = dates;

                timeToWhirl = floatRandomRange(minTimeToWhirl / whirlDifficulty, maxTimeToWhirl / whirlDifficulty);
            }

            if (level == null)
            {
                level = GameObject.Find("LevelController").GetComponent <LevelControllerScript> ();
            }
            string lvl      = level.locationName.Substring(0, 6);
            int    nShadows = level.retrieveIntValue(lvl + "SpawnedShadows");

            if (nShadows >= ShadowSpawnController.maxShadows)
            {
                state = InterconNetworkState.driftingAway;
            }
        }

        if (state == InterconNetworkState.driftingAway)
        {         // pursuing player
            if (!deletedWhirlwinds)
            {
                if (GameObject.Find("Whirlwind") != null)
                {
                    Destroy(GameObject.Find("Whirlwind"));
                }
                else
                {
                    deletedWhirlwinds = true;
                }
            }

            elapsedVeeringTime += Time.deltaTime;
            if (elapsedVeeringTime > timeToVeer)
            {
                elapsedVeeringTime = 0.0f;

                //int r = Random.Range (0, 100);

                Vector3 pPos  = player.transform.position;
                Vector3 tPos  = this.transform.position;
                Vector3 delta = -(pPos - tPos);                 // flee from player
                delta.Normalize();
                targetAngle = Mathf.Acos(delta.x);
                if (delta.z < 0.0)
                {
                    targetAngle = (2.0f * 3.1416f) - targetAngle;
                }

                linearSpeed = floatRandomRange(minLinearSpeed, maxLinearSpeed);
            }
        }

        if (state == InterconNetworkState.relaxed)
        {         // just float by...
            elapsedVeeringTime += Time.deltaTime;
            if (elapsedVeeringTime > timeToVeer)
            {
                elapsedVeeringTime = 0.0f;

                //int r = Random.Range (0, 6.28f);
                float newAngle = FloatRandom.floatRandomRange(0, 6.28f);

                targetAngle = newAngle;

                linearSpeed = floatRandomRange(minLinearSpeed, maxLinearSpeed);
            }
        }

        if (angle < targetAngle)
        {
            angle += angleSpeed * Time.deltaTime;
            if (angle > targetAngle)
            {
                angle = targetAngle;
            }
        }

        if (angle > targetAngle)
        {
            angle -= angleSpeed * Time.deltaTime;
            if (angle < targetAngle)
            {
                angle = targetAngle;
            }
        }
    }