Exemple #1
0
    //--------------------------------------- END CHANGE LEVEL ---------------------------------------
    public void setManager()
    {
        if ((level == 0 || level == 1) && gameObject) {
            DestroyImmediate(gameObject);
        }
        canChangeLevel = true;
        jellyFish = GameObject.FindWithTag ("Player");
        rScore = (GameObject.FindGameObjectWithTag ("RedScore")).GetComponent<RedScore> ()as RedScore;
        bScore = (GameObject.FindGameObjectWithTag ("BlueScore")).GetComponent<BlueScore> ()as BlueScore;
        yScore = (GameObject.FindGameObjectWithTag ("YellowScore")).GetComponent<YellowScore> ()as YellowScore;
        lightVisible = jellyFish.GetComponentsInChildren<Light> (false) as Light[];
        lightRange = lightVisible[0].range;

        jellyfishLight = jellyFish.GetComponentInChildren<lightPulse> () as lightPulse;
        jellyfishColorManager = jellyFish.GetComponent<ColorManager> () as ColorManager;
        jellyfishLight.updateJellyfishLightColor (currentLightColor);
        jellyfishColorManager.updateColorJellyfish (currentColor);
        mainCamera = Camera.main;
        lightImpulse = false;
        barrier = false;
        flash = false;
        lightImpulseCamera = false;
        oldSizeCamera = mainCamera.orthographicSize;
        anImpulse = (GameObject.FindGameObjectWithTag ("impulse")).GetComponent<Animator> () as Animator;
        anWarning = (GameObject.FindGameObjectWithTag ("warning")).GetComponent<Animator>() as Animator;
        anBarrier = (GameObject.FindGameObjectWithTag ("barrier")).GetComponent<Animator> () as Animator;
        anFlash = (GameObject.FindGameObjectWithTag ("flash")).GetComponent<Animator> () as Animator;
        anRedTimer = (GameObject.FindGameObjectWithTag ("redTimer")).GetComponent<Animator> () as Animator;
        anBlueTimer = (GameObject.FindGameObjectWithTag ("blueTimer")).GetComponent<Animator> () as Animator;
        anYellowTimer = (GameObject.FindGameObjectWithTag ("yellowTimer")).GetComponent<Animator> () as Animator;
        anLoading = (GameObject.Find ("Loading")).GetComponent<Animator>() as Animator;
        barrierCollider = (GameObject.FindGameObjectWithTag ("barrier")).GetComponent<CircleCollider2D> () as CircleCollider2D;

        tutorialText = GameObject.Find ("TutorialText").GetComponent<Text> () as Text;
        anTutorial = GameObject.Find ("TutorialText").GetComponent<Animator> () as Animator;

        gameOver = (GameObject.Find ("Controller")).GetComponent<GameOverMenu> () as GameOverMenu;

        barrierAudio = GameObject.FindGameObjectWithTag ("barrier").GetComponent<AudioSource> () as AudioSource;
        impulseAudio = GameObject.FindGameObjectWithTag ("impulse").GetComponent<AudioSource> () as AudioSource;
        flashAudio = GameObject.FindGameObjectWithTag ("flash").GetComponent<AudioSource> () as AudioSource;

        if (unlockBarrier) {
            anBlueTimer.SetTrigger("barrierUnlocked");
        }
        if (unlockFlash) {
            anYellowTimer.SetTrigger("flashUnlocked");
        }
        if (unlockImpulse) {
            anRedTimer.SetTrigger("impulseUnlocked");
        }

        tryBlue = 0;
        tryRed = 0;
        tryYellow = 0;
        if (level != 1)
            anLoading.SetTrigger ("stopLoading");

        if (level == 2) {
            StartCoroutine(initTutorial());
        }
    }