コード例 #1
0
    //Setup all startup game stuff
    public void Setup()
    {
        //Indicate that gameFinsihed is false
        gameFinished = false;

        //Set start time counter
        m_StartTime = Time.time;

        //Assign level number to gui
        txtLevelNo.text = "Level: " + Application.loadedLevelName.After("_");

        //Get all UI Buttons in order to assign them click sound
        GameObject btnResume    = GeneralMethods.GetChildWithName(pausePanel, "BtnResume");
        GameObject btnExitPause = GeneralMethods.GetChildWithName(pausePanel, "BtnExit");
        GameObject btnRetry     = GeneralMethods.GetChildWithName(losePanel, "BtnRestart");
        GameObject btnExitLose  = GeneralMethods.GetChildWithName(losePanel, "BtnExit");
        GameObject btnNext      = GeneralMethods.GetChildWithName(winPanel, "BtnNext");
        GameObject btnExitWin   = GeneralMethods.GetChildWithName(winPanel, "BtnExit");

        //Assign buttons the click sound when clicked (instead of doing it in inspector manually)
        GeneralMethods.AssignSoundToButton(pauseBtn, "Click");
        GeneralMethods.AssignSoundToButton(btnResume, "Click");
        GeneralMethods.AssignSoundToButton(btnExitPause, "Click");
        GeneralMethods.AssignSoundToButton(btnRetry, "Click");
        GeneralMethods.AssignSoundToButton(btnExitLose, "Click");
        GeneralMethods.AssignSoundToButton(btnNext, "Click");
        GeneralMethods.AssignSoundToButton(btnExitWin, "Click");

        //Save that this level has been accessed so the MainMenu can enable it
        PlayerPrefManager.UnlockLevel();
    }