Пример #1
0
    void Start()
    {
        HUDCamera                 = (Camera)GameObject.Find("HUDMainGroup/HUDCamera").GetComponent(typeof(Camera));
        hShopScriptCS             = (ShopScriptCS)GameObject.Find("MenuGroup/Shop").GetComponent(typeof(ShopScriptCS));
        hInGameScriptCS           = (InGameScriptCS)GameObject.Find("Player").GetComponent(typeof(InGameScriptCS));
        hPowerupsMainControllerCS = (PowerupsMainControllerCS)GameObject.Find("Player").GetComponent(typeof(PowerupsMainControllerCS));

        if (upgradeCost <= 0)
        {
            Debug.Log("EXCEPTION: No cost assigned to the Power-up shop element. Check the user documentation.");
        }
        else if (powerupUpgradeLevelMAX <= 0)
        {
            Debug.Log("EXCEPTION: Power-up upgrade level cannot be zero. Check the user documentation.");
        }

        tBuyButton  = (Transform)this.transform.Find("Buttons/Button_Buy").GetComponent(typeof(Transform));
        tmCost      = (TextMesh)this.transform.Find("CostGroup/Text_Currency").GetComponent(typeof(TextMesh));
        tmCost.text = upgradeCost.ToString();        //set the cost of the item as specified by the user

        //Update the text on the power-up item in shop
        (this.transform.Find("Text_ItemLevel").GetComponent("TextMesh") as TextMesh).text = "Level " + currentPowerupLevel;

        setShopPowerupScriptEnabled(false);        //turn off current script
    }
Пример #2
0
    void Start()
    {
        HUDCamera       = (Camera)GameObject.Find("HUDMainGroup/HUDCamera").GetComponent(typeof(Camera));
        hShopScriptCS   = (ShopScriptCS)GameObject.Find("MenuGroup/Shop").GetComponent(typeof(ShopScriptCS));
        hInGameScriptCS = (InGameScriptCS)GameObject.Find("Player").GetComponent(typeof(InGameScriptCS));

        if (itemCost <= 0)
        {
            Debug.Log("EXCEPTION: No cost assigned to the Utility shop element. Check the user documentation.");
        }

        tBuyButton  = (Transform)this.transform.Find("Buttons/Button_Buy").GetComponent(typeof(Transform));
        tmCost      = (TextMesh)this.transform.Find("CostGroup/Text_Currency").GetComponent(typeof(TextMesh));
        tmCost.text = itemCost.ToString();        //set the cost of the item as specified by the user

        setShopUtilityScriptEnabled(false);       //turn off current script
    }
Пример #3
0
    void Start()
    {
        HUDCamera       = (Camera)GameObject.Find("HUDMainGroup/HUDCamera").GetComponent(typeof(Camera));
        hShopScriptCS   = (ShopScriptCS)GameObject.Find("MenuGroup/Shop").GetComponent(typeof(ShopScriptCS));
        hInGameScriptCS = (InGameScriptCS)GameObject.Find("Player").GetComponent(typeof(InGameScriptCS));

        tBuyButton   = (Transform)this.transform.Find("Buttons/Button_Buy").GetComponent(typeof(Transform));
        tEquipButton = (Transform)this.transform.Find("Buttons/Button_Equip").GetComponent(typeof(Transform));
        tmCost       = (TextMesh)this.transform.Find("CostGroup/Text_Currency").GetComponent(typeof(TextMesh));
        tmCost.text  = costumeCost.ToString();       //display the costume cost in shop as specified by the user

        if (characterMaterial == null)
        {
            Debug.Log("EXCEPTION: Character material not assigned to costume shop element. Check the user documentation.");
        }
        else if (characterCostume == null)
        {
            Debug.Log("EXCEPTION: Character texture not assigned to costume shop element. Check the user documentation.");
        }
        else if (costumeCost <= 0)
        {
            Debug.Log("EXCEPTION: No cost assigned to the costume shop element. Check the user documentation.");
        }

        if (characterMaterial.GetTexture("_MainTex") == characterCostume)        //is the currently applied texture?
        {
            costumeOwned = true;
            tBuyButton.gameObject.SetActive(false);
            tEquipButton.gameObject.SetActive(true);
        }
        else
        {
            costumeOwned = false;
            tBuyButton.gameObject.SetActive(true);
            tEquipButton.gameObject.SetActive(false);
        }

        setShopCostumeScriptEnabled(false);        //turn off current script
    }
Пример #4
0
    void Start()
    {
        HUDCamera       = (Camera)GameObject.Find("HUDMainGroup/HUDCamera").GetComponent(typeof(Camera));
        hShopScriptCS   = (ShopScriptCS)GameObject.Find("MenuGroup/Shop").GetComponent(typeof(ShopScriptCS));
        hInGameScriptCS = (InGameScriptCS)GameObject.Find("Player").GetComponent(typeof(InGameScriptCS));

        if (itemCost <= 0)
        {
            Debug.Log("EXCEPTION: No cost assigned to the IAP shop element. Check the user documentation.");
        }
        else if (itemReward <= 0)
        {
            Debug.Log("EXCEPTION: No reward assigned to the IAP shop element. Check the user documentation.");
        }

        tBuyButton      = (Transform)this.transform.Find("Buttons/Button_Buy").GetComponent(typeof(Transform));
        tmItemCost      = (TextMesh)this.transform.Find("Item_Cost").GetComponent(typeof(TextMesh));
        tmItemCost.text = "$ " + itemCost.ToString();        //set the cost as specified by user

        tmItemReward      = (TextMesh)this.transform.Find("ItemGroup/Text_Reward").GetComponent(typeof(TextMesh));
        tmItemReward.text = itemReward.ToString(); //set the virtual currency reward as specified by the user

        setShopIAPScriptEnabled(false);            //turn off current script
    }
Пример #5
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
    }