new void Start()
 {
     exit = false;
     if (fader == null)
     {
         fader = GameObject.Find("Fader").GetComponent <UIFaderScript> ();
     }
 }
    new void Start()
    {
        lose = false;
        fRef = UIFader.GetComponent <UIFaderScript> ();

        fRef.setFadeValue(0.0f);
        fRef.Initialize();
        fRef.fadeIn();

        finished = false;

        mcRef = GameObject.Find("MasterController").GetComponent <MasterControllerScript> ();

        if (mcRef != null)
        {
            sentenceBits = mcRef.getSentencePieces().ToArray();
        }

        nPieces = sentenceBits.Length;

        bitGO = new GameObject[nPieces];

        actionState = 0;

        for (int i = 0; i < nPieces; ++i)
        {
            bitGO[i] = new GameObject();
            SentenceBit newBit;
            newBit = bitGO [i].AddComponent <SentenceBit> ();
            newBit.Initialize();

            newBit.setText(sentenceBits [i]);
            newBit.randomizePosition(volumeRadius);
            newBit.randomizeSpeed();
            newBit.setCamera(cam);
            newBit.order  = i;
            newBit.parent = this;

            newBit.setPosition(new Vector3(0, 0, 0));
            bitGO [i].name = "SentenceBit" + i;
        }

        completeSentence = sentenceBits [0];
        for (int i = 1; i < sentenceBits.Length; ++i)
        {
            completeSentence = completeSentence + " " + sentenceBits [i];
        }

        setText("");

        mcRef.getStorage().storeStringValue("ReturnFromActivity", "Well");
        mcRef.getStorage().storeIntValue("ActivityResult", 0);

        isWaitingForActionToComplete = true;
    }
Ejemplo n.º 3
0
    new public void Start()
    {
        if (started)
        {
            return;
        }
        started = true;

        GameObject hud = GameObject.FindGameObjectWithTag("HUD");

        if (hud != null)
        {
            dialogueController = hud.GetComponentInChildren <DialogueObject> ();
            alertController    = hud.GetComponentInChildren <alertImageController> ();
            fader = hud.GetComponentInChildren <UIFaderScript> ();
            SetFaderColor();
            vignette = hud.GetComponentInChildren <VignetteScript> ();
        }

        Application.targetFrameRate = 30;

        mcRef.changeLocation(locationName);

        if (locationName.StartsWith("Level"))
        {
            Debug.Log("<color=purple>Storing CurrentLevel : " + locationName.Substring(0, 6) + "</color>");
            ds.storeStringValue("CurrentLevel", locationName.Substring(0, 6));
        }

        if (locationName.StartsWith("Level"))
        {
            string lvl = locationName.Substring(5, 1);
            mcRef.getStorage().storeBoolValue("HasVisitedWorld" + lvl, true);
        }

        plyr = GameObject.Find("Player");
        //GameObject hud = null;
        if (plyr != null)
        {
            hud = plyr.GetComponent <PlayerScript>().currentHUD;           //GameObject.FindGameObjectWithTag ("HUD");
        }

        if (hud != null)
        {
            dialogueController = hud.GetComponentInChildren <DialogueObject> ();
            alertController    = hud.GetComponentInChildren <alertImageController> ();
            fader    = hud.GetComponentInChildren <UIFaderScript> ();
            vignette = hud.GetComponentInChildren <VignetteScript> ();
            SetFaderColor();
        }

        string objectToDestroy;


        // take care of flame re-spawning into the level
        int    flameCount;
        string lvlname = SceneManager.GetActiveScene().name;

        for (int k = 0; k < MaxFlames; ++k)
        {
            flameCount = mcRef.getStorage().retrieveIntValue("Flame" + k + "Resurrect" + lvlname);
            if (flameCount > 0)
            {
                --flameCount;
                if (flameCount == 0)
                {
                    string flamename = mcRef.getStorage().retrieveStringValue("Flame" + k + "Resurrect" + lvlname);
                    mcRef.unPickUpObject(flamename);
                }

                mcRef.getStorage().storeIntValue("Flame" + k + "Resurrect" + lvlname, flameCount);
            }
        }

        /* destroy all objects that have already been picked up
         * on this location
         */
        objectToDestroy = mcRef.nextPickedUpObject();
        while (!objectToDestroy.Equals(""))
        {
            Debug.Log("<color=red>  -> Pick up destroying " + objectToDestroy + "</color>");
            Destroy(GameObject.Find(objectToDestroy));
            objectToDestroy = mcRef.nextPickedUpObject();
        }

        if (mcRef.hasCurrentLocationBeenVisited())
        {
            //plyr.transform.position = mcRef.getPlayerSpawnLocation ();
        }

        if (openVignette)
        {
            //vignette.setVignetteScale (0.0f);
            if (vignette != null)
            {
                bool inhibit = retrieveBoolValue("InhibitVignette");
                if (!inhibit)
                {
                    vignette._wm_open();
                }
                else
                {
                    if (ds.retrieveBoolValue("FadeWhite"))
                    {
                        ds.storeBoolValue("FadeWhite", false);
                        foreach (UIFaderScript fullScreenFader in fullScreenFaders)
                        {
                            fullScreenFader.setFadeColor(1.0f, 1.0f, 1.0f);
                            fullScreenFader.autoFadeIn = true;
                            fullScreenFader.setFadeValue(0.0f);
                            fullScreenFader.fadeIn();
                        }
                    }
                    else
                    {
                        fader.autoFadeIn = false;
                        fader.preventAutoFader();
                        fader.setFadeValue(1.0f);
                        foreach (UIFaderScript fullScreenFader in fullScreenFaders)
                        {
                            fullScreenFader.setFadeValue(1.0f);
                            fullScreenFader.autoFadeIn = false;
                        }
                    }
                }
                storeBoolValue("InhibitVignette", false);
            }
        }

        if (alertController != null)
        {
            alertController._wm_reset();
        }

        if (!BGMusic.Equals(""))
        {
            mcRef.playMusic(BGMusic);
        }
    }