Exemplo n.º 1
0
 public Timer(MainFrame mainFrame, MenuIDs menuIDs)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 2
0
    private TextMesh tmPauseCountdown;          //count down numbers after resume


    void Start()
    {
        HUDCamera             = (Camera)GameObject.Find("HUDMainGroup/HUDCamera").GetComponent(typeof(Camera));
        hControllerScriptCS   = (ControllerScriptCS)GameObject.Find("Player").GetComponent(typeof(ControllerScriptCS));
        hSoundManagerScriptCS = (SoundManagerCS)GameObject.Find("SoundManager").GetComponent(typeof(SoundManagerCS));
        hInGameScriptCS       = (InGameScriptCS)GameObject.Find("Player").GetComponent(typeof(InGameScriptCS));
        hMissionsControllerCS = (MissionsControllerCS)GameObject.Find("Player").GetComponent(typeof(MissionsControllerCS));

        //the fResolutionFactor can be used to adjust components according to screen size
        aspectRatio       = ((Screen.height * 1.0f) / (Screen.width * 1.0f) - 1.77f);
        fResolutionFactor = (43.0f * (aspectRatio));

        tMenuGroup      = GameObject.Find("MenuGroup").transform;
        tMenuTransforms = new Transform[(int)MenuIDs.GetValues(typeof(MenuIDs)).Length];

        //main menu initialization
        tMenuTransforms[(int)MenuIDs.MainMenu] = (Transform)tMenuGroup.Find("MainMenu").GetComponent(typeof(Transform));
        tMainMenuButtons    = new Transform[iMainMenuButtonsCount];
        tMainMenuButtons[0] = tMenuTransforms[(int)MenuIDs.MainMenu].Find("Buttons/Button_TapToPlay");
        tMainMenuButtons[1] = tMenuTransforms[(int)MenuIDs.MainMenu].Find("Buttons/Button_Instructions");
        tMainMenuButtons[2] = tMenuTransforms[(int)MenuIDs.MainMenu].Find("Buttons/Button_Settings");
        tMainMenuButtons[3] = tMenuTransforms[(int)MenuIDs.MainMenu].Find("Buttons/Button_Shop");
        tMainMenuButtons[4] = tMenuTransforms[(int)MenuIDs.MainMenu].Find("Buttons/Button_Missions");
        tMainMenuButtons[5] = tMenuTransforms[(int)MenuIDs.MainMenu].Find("Buttons/Button_Achievements");

        //pause menu initialization
        tMenuTransforms[(int)MenuIDs.PauseMenu] = (Transform)tMenuGroup.Find("PauseMenu").GetComponent(typeof(Transform));
        tPauseButtons          = new Transform[iPauseButtonsCount];
        tPauseButtons[0]       = tMenuTransforms[(int)MenuIDs.PauseMenu].Find("Buttons/Button_Back");
        tPauseButtons[1]       = tMenuTransforms[(int)MenuIDs.PauseMenu].Find("Buttons/Button_Resume");
        tmPauseMenuMissionList = (TextMesh)tMenuTransforms[(int)MenuIDs.PauseMenu].Find("Text_MissionDescription").GetComponent(typeof(TextMesh));

        //game over menu initialization
        tMenuTransforms[(int)MenuIDs.GameOverMenu] = (Transform)tMenuGroup.Find("GameOver").GetComponent(typeof(Transform));
        tGameOverButtons    = new Transform[iGameOverButtonsCount];
        tGameOverButtons[0] = tMenuTransforms[(int)MenuIDs.GameOverMenu].Find("Buttons/Button_Back");
        tGameOverButtons[1] = tMenuTransforms[(int)MenuIDs.GameOverMenu].Find("Buttons/Button_Play");

        //instructions menu initialization
        tMenuTransforms[(int)MenuIDs.InstructionsMenu] = (Transform)tMenuGroup.Find("Instructions").GetComponent(typeof(Transform));
        tInstructionsButtons    = new Transform[iInstructionsButtonsCount];
        tInstructionsButtons[0] = (Transform)tMenuTransforms[(int)MenuIDs.InstructionsMenu].Find("Buttons/Button_Back").GetComponent(typeof(Transform));

        //settings menu initialization
        tMenuTransforms[(int)MenuIDs.SettingsMenu] = (Transform)tMenuGroup.Find("Settings").GetComponent(typeof(Transform));
        tSettingsButtons    = new Transform[iSettingsButtonsCount];
        tSettingsButtons[0] = tMenuTransforms[(int)MenuIDs.SettingsMenu].Find("Buttons/Button_Back");
        tSettingsButtons[1] = (Transform)tMenuTransforms[(int)MenuIDs.SettingsMenu].Find("ControlType/Button_Swipe/RadioButton_Background").GetComponent(typeof(Transform));
        tSettingsButtons[2] = (Transform)tMenuTransforms[(int)MenuIDs.SettingsMenu].Find("ControlType/Button_Gyro/RadioButton_Background").GetComponent(typeof(Transform));
        tSettingsButtons[3] = (Transform)tMenuTransforms[(int)MenuIDs.SettingsMenu].Find("Music/Button_ON/RadioButton_Background").GetComponent(typeof(Transform));
        tSettingsButtons[4] = (Transform)tMenuTransforms[(int)MenuIDs.SettingsMenu].Find("Music/Button_OFF/RadioButton_Background").GetComponent(typeof(Transform));
        tSettingsButtons[5] = (Transform)tMenuTransforms[(int)MenuIDs.SettingsMenu].Find("Sound/Button_ON/RadioButton_Background").GetComponent(typeof(Transform));
        tSettingsButtons[6] = (Transform)tMenuTransforms[(int)MenuIDs.SettingsMenu].Find("Sound/Button_OFF/RadioButton_Background").GetComponent(typeof(Transform));

        mrSwipeControls = (MeshRenderer)tMenuTransforms[(int)MenuIDs.SettingsMenu].Find("ControlType/Button_Swipe/RadioButton_Foreground").GetComponent(typeof(MeshRenderer));
        mrGyroControls  = (MeshRenderer)tMenuTransforms[(int)MenuIDs.SettingsMenu].Find("ControlType/Button_Gyro/RadioButton_Foreground").GetComponent(typeof(MeshRenderer));
        mrMusicON       = (MeshRenderer)tMenuTransforms[(int)MenuIDs.SettingsMenu].Find("Music/Button_ON/RadioButton_Foreground").GetComponent(typeof(MeshRenderer));
        mrMusicOFF      = (MeshRenderer)tMenuTransforms[(int)MenuIDs.SettingsMenu].Find("Music/Button_OFF/RadioButton_Foreground").GetComponent(typeof(MeshRenderer));
        mrSoundON       = (MeshRenderer)tMenuTransforms[(int)MenuIDs.SettingsMenu].Find("Sound/Button_ON/RadioButton_Foreground").GetComponent(typeof(MeshRenderer));
        mrSoundOFF      = (MeshRenderer)tMenuTransforms[(int)MenuIDs.SettingsMenu].Find("Sound/Button_OFF/RadioButton_Foreground").GetComponent(typeof(MeshRenderer));

        //shop
        tMenuTransforms[(int)MenuIDs.Shop] = tMenuGroup.Find("Shop").GetComponent(typeof(Transform)) as Transform;
        hShopScriptCS = (ShopScriptCS)tMenuTransforms[(int)MenuIDs.Shop].GetComponent(typeof(ShopScriptCS));

        //missions menu
        tMenuTransforms[(int)MenuIDs.MissionsMenu] = (Transform)tMenuGroup.Find("MissionsMenu").GetComponent(typeof(Transform));
        tMissionsMenuButtons      = new Transform[iMissionsMenuButtonsCount];
        tMissionsMenuButtons[0]   = (Transform)tMenuTransforms[(int)MenuIDs.MissionsMenu].Find("Buttons/Button_Back").GetComponent(typeof(Transform));      //back button
        tmMissionsMenuMissionList = (TextMesh)tMenuTransforms[(int)MenuIDs.MissionsMenu].Find("Text_MissionDescription").GetComponent(typeof(TextMesh));

        //achievements menu
        tMenuTransforms[(int)MenuIDs.AchievementsMenu] = (Transform)tMenuGroup.Find("AchievementsMenu").GetComponent(typeof(Transform));
        tAchievementMenuButtons       = new Transform[iAchievementMenuButtonsCount];
        tAchievementMenuButtons[0]    = (Transform)tMenuTransforms[(int)MenuIDs.AchievementsMenu].Find("Buttons/Button_Back").GetComponent(typeof(Transform));    //back button
        tmAchievementsMenuDescription = (TextMesh)tMenuTransforms[(int)MenuIDs.AchievementsMenu].Find("Text_Achievements").GetComponent(typeof(TextMesh));        //text mesh containing achievments

        ///////HUD//////
        ((MeshRenderer)GameObject.Find("HUDMainGroup/HUDPauseCounter").GetComponent(typeof(MeshRenderer))).enabled = false;

        //set the HUD position according to the screen resolution
        ((Transform)GameObject.Find("HUDMainGroup/HUDGroup/HUDCurrencyGroup").GetComponent(typeof(Transform))).transform.Translate(-fResolutionFactor, 0, 0);
        (GameObject.Find("HUDMainGroup/HUDGroup/HUDScoreGroup").GetComponent(typeof(Transform)) as Transform).transform.Translate(-fResolutionFactor, 0, 0);
        (GameObject.Find("HUDMainGroup/HUDGroup/HUDPause").GetComponent(typeof(Transform)) as Transform).transform.Translate(fResolutionFactor, 0, 0);

        ShowMenu((int)MenuIDs.MainMenu);                //show Main Menu on game launch
    }