Example #1
0
    // Update is called once per frame

    void Start()
    {
        soundManager = GameObject.FindWithTag("MusicManager");
        makeSound    = soundManager.GetComponent <MakeSound> ();
        audioSource  = GetComponent <AudioSource> ();

        sounds = new AudioClip[makeSound.audioclips.Length];
        for (int a = 0; a < makeSound.audioclips.Length; a++)
        {
            sounds [a] = makeSound.audioclips [a];
        }


        GameObject birdGenObj = GameObject.FindWithTag("BirdGenerator");

        birdGenerator     = birdGenObj.GetComponent <BirdGenerator> ();
        birdKeys          = birdGenerator.birdKeys;
        allowedToPlay     = true;
        happyParticles    = transform.Find("BirdHappyParticles").GetComponent <ParticleSystem> ();
        confusedParticles = transform.Find("BirdConfusedParticles").GetComponent <ParticleSystem> ();
        playingParticles  = transform.Find("BirdPlayingParticles").GetComponent <ParticleSystem> ();
        birdRenderer      = transform.Find("pCube8").GetComponent <Renderer> ();

        callUI = GameObject.FindWithTag("MainCamera").GetComponent <Call_UI> ();


        playingParticles.startColor  = particleColor;
        confusedParticles.startColor = particleColor;

        birdRenderer.material = birdMaterial;
        confusedParticles.transform.GetComponent <ParticleSystemRenderer> ().material = confusedMaterial;
        playingParticles.transform.GetComponent <ParticleSystemRenderer> ().material  = playingMaterial;
    }
Example #2
0
    // Use this for initialization
    void Start()
    {
        for (int f = 0; f < birdUIfills.Length; f++)
        {
            birdUIfills [f].fillAmount = 0f;
        }

        song            = GetComponent <Songlist> ();
        characterani    = GameObject.FindWithTag("PlayerCharacter").GetComponent <Animator> ();
        endBk           = GameObject.FindWithTag("SunriseCanvas").GetComponent <Animator> ();
        treeLight       = GameObject.FindWithTag("Tree").GetComponent <Animator> ();
        birdGenerator   = birdGeneratorObj.GetComponent <BirdGenerator> ();
        playerParticles = player.GetComponentInChildren <ParticleSystem> ();
        callUI          = mainCamera.GetComponent <Call_UI> ();

        audios = new List <GameObject> ();
        currentlyPlayingAudio = new bool[10];
        currentlyFadingOut    = new bool[10];
        for (int i = 0; i < 10; i++)
        {
            currentlyPlayingAudio [i] = false;
            currentlyFadingOut [i]    = false;
        }
        keyPressed          = false;
        keyPressedThisFrame = false;

        UpperBodyTurn = GameObject.FindWithTag("UpperBodyTurn");

        audioSource  = GetComponent <AudioSource> ();
        note         = 0;
        ifFinish     = false;
        birdsPresent = false;

        matrixSize       = 10;
        transitionMatrix = new int[matrixSize, matrixSize];
        tripletList      = new List <int[]> ();
        ParseTransitionMatrix();

        currentActiveTripletIndex = 0;
        currentActiveNoteIndex    = 0;
        currentMaxTripletIndex    = 0;
        prevIndex = 0;
    }