Ejemplo n.º 1
0
    void Awake()
    {
        // Register the singleton
        if (Instance != null)
        {
            Debug.LogError("Multiple instances of BeatsEngine!");
        }
        Instance = this;

        audioSource       = GetComponent <AudioSource>();
        sunScript         = sun.GetComponent <SunScript>();
        terrainGeneration = GetComponent <TerrainGeneration>();
    }
Ejemplo n.º 2
0
    IEnumerator engage()
    {
        for (float timer = 0; timer <= 2; timer += Time.deltaTime)
        {
            yield return(0);
        }

        GameObject   player = GameObject.FindGameObjectWithTag("Player");
        PlayerScript ps     = player.GetComponent <PlayerScript>();

        ps.baseSpeed = playerBaseSpeed;

        BeatsEngine beatsEngine = GetComponent <BeatsEngine>();

        beatsEngine.engage();
    }
Ejemplo n.º 3
0
    void OnGUI()
    {
        if (gameOverFlag)
        {
            beatsEngine = GetComponent <BeatsEngine> ();
            const int buttonWidth     = 256;
            const int buttonHeight    = 128;
            int       rainCloudWidth  = (Screen.width / 2);
            int       rainCloudHeight = (Screen.height / 2);



            if (
                GUI.Button(
                    new Rect(
                        Screen.width - (Screen.width / 16) - (buttonWidth),
                        (3 * Screen.height / 5) - (buttonHeight / 2),
                        buttonWidth,
                        buttonHeight
                        ),
                    btnRetryTexture,
                    dashGUIStyle
                    ))
            {
                // Reload the level
                Application.LoadLevel("level");
            }

            if (
                GUI.Button(
                    new Rect(
                        Screen.width - (Screen.width / 16) - (buttonWidth),
                        (4 * Screen.height / 5) - (buttonHeight / 2),
                        buttonWidth,
                        buttonHeight
                        ),
                    btnMenuTexture,
                    dashGUIStyle
                    ))
            {
                // Reload the level
                Application.LoadLevel("intro-3-full");
            }

            // Displays the final score
            GUI.Label(
                new Rect(Screen.width - (Screen.width / 16) - (buttonWidth), (2 * Screen.height / 5) - (buttonHeight / 2),
                         buttonWidth,
                         buttonHeight
                         ),
                "Final Score: " + beatsEngine.bpm,
                dashGUIStyle);

            // Decorative "Game Over" Raincloud
            GUI.Label(
                new Rect((Screen.width / 2) - (rainCloudWidth / 2), 10,
                         rainCloudWidth,
                         rainCloudHeight
                         ),
                gameOverTexture,
                dashGUIStyle);
        }
    }