Ejemplo n.º 1
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.º 2
0
 public new void _wm_hide()
 {
     if (selected == -1)
     {
         return;
     }
     duendeCoco [selected - 1]._wm_hide();
     level.storeIntValue(retrieveVariable, 0);
 }
Ejemplo n.º 3
0
 public void _wm_setActiveByIndex(int channel, bool en)
 {
     if (reentrant)
     {
         if (en)
         {
             level.storeIntValue(channels [channel].theObject.name + "isActive", 1);
         }
         else
         {
             level.storeIntValue(channels [channel].theObject.name + "isActive", -1);
         }
     }
     channels [channel].theObject.SetActive(en);
 }
Ejemplo n.º 4
0
    public void _wm_switchChannel(int ch)
    {
        for (int i = 0; i < channel.Length; ++i)
        {
            if (i == ch)
            {
                channel [i].SetActive(true);
            }
            else
            {
                channel [i].SetActive(false);
            }
        }

        if (reentrant)
        {
            if (level == null)
            {
                level = GameObject.Find("LevelController").GetComponent <LevelControllerScript> ();
            }
            if (level != null)
            {
                level.storeIntValue("TVChannel" + screenId, ch);
            }
        }
    }
Ejemplo n.º 5
0
    public void setEnableLevel1(bool en)
    {
        canvas2.enabled = en;
        shadow.enabled  = en;
        if (en)
        {
            int s = levelRef.retrieveIntValue("DefeatedShadows");
            shadowText.text = "x " + s;
        }
        shadowText.enabled = en;
        flame.enabled      = en;
        flameText.enabled  = en;
        well.enabled       = en;
        wellText.enabled   = en;
        back1.enabled      = en;

        redManaText.enabled = en;
        if (en)
        {
            if (levelRef.retrieveIntValue("RedMana") <= 0)
            {
                levelRef.storeIntValue("RedMana", 0);
            }
            redManaText.text = "x " + levelRef.retrieveIntValue("RedMana");
        }
        blueManaText.enabled = en;
        if (en)
        {
            if (levelRef.retrieveIntValue("BlueMana") <= 0)
            {
                levelRef.storeIntValue("BlueMana", 0);
            }
            blueManaText.text = "x " + levelRef.retrieveIntValue("BlueMana");
        }
    }
    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.º 7
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.º 8
0
	public void meditate() 
	{
		state2 = PlayerState.meditating;
        setOrientation(0);
		elapsedTime = 0.0f;
        levelRef.storeBoolValue("Meditating", true);
        levelRef.storeIntValue("Orientation", 0);
        blockedElapsedTime = 0.0f;
		blocked = true;
		meditationFrame = 0;
		playerRendRef.sprite = Meditating [0];
		otherPlayerRendRef.sprite = Meditating [0];
	}
    public void crossGate(int n)
    {
        if (n == advanceSlice)
        {
            int sliceToMove = (advanceSlice + nOfSlices - 2) % nOfSlices;             // equivalent to (advanceSlice - 1) % nOfSlices
            moveSlice(sliceToMove, true);
            advanceSlice = (advanceSlice + 1) % nOfSlices;
            retreatSlice = (retreatSlice + 1) % nOfSlices;
            ++actualSlice;
            level.storeIntValue(SliceControllerName + "slice", actualSlice);
        }

        else if (n == retreatSlice && actualSlice > 0)
        {
            int sliceToMove = (retreatSlice + nOfSlices - 1) % nOfSlices;
            moveSlice(sliceToMove, false);
            advanceSlice = (advanceSlice + nOfSlices - 1) % nOfSlices;
            retreatSlice = (retreatSlice + nOfSlices - 1) % nOfSlices;
            --actualSlice;
            level.storeIntValue(SliceControllerName + "slice", actualSlice);
        }
    }
Ejemplo n.º 10
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);
         }
     }
 }
Ejemplo n.º 11
0
    void OnTriggerEnter(Collider other)
    {
        if (other.tag != "Player")
        {
            return;
        }

        level.storeIntValue("MagoElegido", numMago);
        this.isWaitingForActionToComplete = true;
        if (vignette != null)
        {
            vignette._wa_close(this);
        }
        state = 1;
    }
Ejemplo n.º 12
0
    void OnTriggerEnter(Collider other)
    {
        if (other.tag != "Player")
        {
            return;
        }

        this.isWaitingForActionToComplete = true;
        level.vignette._wa_close(this);
        state = 1;

        if (forceSpawnCoordinates.sqrMagnitude > 0)
        {
            level.storeFloatValue("Coords" + destination + "X", forceSpawnCoordinates.x);
            level.storeFloatValue("Coords" + destination + "Y", forceSpawnCoordinates.y);
            level.storeFloatValue("Coords" + destination + "Z", forceSpawnCoordinates.z);
        }
        int or = other.GetComponent <PlayerScript> ().orientation();

        level.storeIntValue("Orientation", or);
    }
    public void _wm_step()
    {
        energyRods [solvedRods]._wm_unmove();
        ++solvedRods;
        if (reentrant)
        {
            level.storeIntValue(this.name + "SolvedRods", solvedRods);
        }
        lightIntensity -= 8;

        if (solvedRods == energyRods.Length)
        {
            foreach (SoftMover sm in energyRings)
            {
                sm.gameObject.SetActive(false);
                sm.reset();
                lightIntensity = 0;
            }
        }

        updateLightIntensity();
    }
Ejemplo n.º 14
0
 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);
         }
     }
 }
Ejemplo n.º 15
0
    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();
        }
    }
Ejemplo n.º 16
0
 public void _wm_storeTVid()
 {
     level.storeStringValue("TVFerfuflosId", id);
     level.storeIntValue("TVFerfuflosAmount", amount);
 }
Ejemplo n.º 17
0
 public override void effect()
 {
     Programs[state].startProgram(0);
     state = (state + 1) % Programs.Length;
     level.storeIntValue("Seq" + this.name + "State", state);
 }
Ejemplo n.º 18
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);
        }
    }