Exemple #1
0
    public void FadeOut(float fadeOutRate)
    {
        gameObject.AddComponent <MusicFadeOut>();
        MusicFadeOut musicFadeOut = FindObjectOfType <MusicFadeOut>();

        musicFadeOut.SetFadeOut(audioSource, fadeOutRate);
    }
    //start function
    void Start()
    {
        SceneManager.SetActiveScene(SceneManager.GetSceneByBuildIndex(5));
        //FadeOutAnimation = GameObject.Find("FadeOut").GetComponent<StopAnimationScript>();
        FadeInAnimation = GameObject.Find("FadeIn").GetComponent <StopAnimationScript> ();
        fade.SetActive(false);



        newCanvas       = Instantiate(tutorialCanvas, new Vector3(0.0f, 0.0f, 0.0f), Quaternion.identity);
        tutorialTimeTxt = GUIText.FindObjectOfType <Text>();

        //if the background music prefab isnt in the scene then it will not try and search for it
        if (GameObject.FindGameObjectWithTag("BGMusic") != null)
        {
            backgroundMusic = GameObject.FindGameObjectWithTag("BGMusic");
            m_musicFadeOut  = backgroundMusic.GetComponent <MusicFadeOut>();
        }
        //initialise timer
        m_gameTimer = (int)gameDuration;

        //floating text manager public static utility class initialisation
        FloatingTextManager.Initialise();

        //set up screen orientation and plant grid
        Screen.orientation = ScreenOrientation.Landscape;

        //get the component stuff from the portait prefabs
        //Player1Stats = Player1.GetComponent<PortaitScript> ();
        //Player2Stats = Player2.GetComponent<PortaitScript> ();
        //Player3Stats = Player3.GetComponent<PortaitScript> ();
        // Player4Stats = Player4.GetComponent<PortaitScript> ();
    }
Exemple #3
0
    // Use this for initialization
    void Start()
    {
        SceneManager.SetActiveScene(SceneManager.GetSceneByBuildIndex(6));
        // Set Client ID
        // Set Portraits
        // Set Powerup state
        playerScore = 0.0f;
        m_currState = GAMESTATE.Start;

        m_pedObjects = new List <GameObject>();

        m_spawnTimer    = new float[maxZDist - minZDist];
        m_spawnRateRand = new float[maxZDist - minZDist];

        for (int i = 0; i < maxZDist - minZDist; i++)
        {
            m_spawnRateRand[i] = Random.Range(spawnRateMin, spawnRateMax);
        }

        // Call start menu
        //        StartMenu();

        m_musicFadeOut = backgroundMusic.GetComponent <MusicFadeOut>();



        portraits = GameObject.FindGameObjectsWithTag("Portrait");

        newCanvas = Instantiate(tutorialCanvas, new Vector3(0.0f, 0.0f, 0.0f), Quaternion.identity);

        tutorialTimerTxt = GUIText.FindObjectOfType <Text>();



        //Iterate through the length of the portrait scripts
        for (int i = 0; i < portraits.Length; i++)
        {
            //add the portraits locally
            portraitScripts.Add(portraits [i].GetComponent <PortaitScript> ());

            //find the local player ad set it to the relative portrait
            if (portraitScripts [i].IsLocalPlayerPortrait())
            {
                localPortrait = portraitScripts [i];
            }
        }


        handSpawnScript = handSpawn.GetComponent <HandSpawn> ();
    }