private Transform tHUDPUMeterBar;//the bar in the powerup meter on HUD
	
	void Start()
	{
		tPlayer = transform;	
		
		//powerup meter visual		
		iPowerupCount = PowerUps.GetValues(typeof(PowerUps)).Length-1;//get the total number of powerups
		
		bPowerupStatus = new bool[iPowerupCount];
		fPowerupStartTime = new float[iPowerupCount];	
		fPowerupTotalDuration = new float[iPowerupCount];
	
		hInGameScriptCS = (InGameScriptCS)this.GetComponent(typeof(InGameScriptCS));
		hControllerScriptCS = (ControllerScriptCS)this.GetComponent(typeof(ControllerScriptCS));
		hSoundManagerCS = (SoundManagerCS)GameObject.Find("SoundManager").GetComponent(typeof(SoundManagerCS));
		//hMissionsControllerCS = (MissionsControllerCS)this.GetComponent(typeof(MissionsControllerCS));
		//hGlobalAchievementControllerCS = (GlobalAchievementControllerCS)this.GetComponent(typeof(GlobalAchievementControllerCS));
		hPlayerFrontColliderScriptCS = (PlayerFrontColliderScriptCS)GameObject.Find("PlayerFrontCollider").GetComponent(typeof(PlayerFrontColliderScriptCS));
		hPlayerSidesColliderScriptCS = (PlayerSidesColliderScriptCS)GameObject.Find("PlayerSidesCollider").GetComponent(typeof(PlayerSidesColliderScriptCS));
		
        //power up meter
        //tHUDPUMeter = (Transform)GameObject.Find("HUDMainGroup/HUDPUMeter").GetComponent(typeof(Transform));
        //tHUDPUMeterBar = (Transform)GameObject.Find("HUDMainGroup/HUDPUMeter/HUD_PU_Meter_Bar_Parent").GetComponent(typeof(Transform));
        //tHUDPUMeter.transform.position -= new Vector3(0, 100, 0);//hide the powerup meter

				
		fMagnetismDefaultRadius = 200;
		fMangetismRadius = 200;		//default: pull currency toward the character
		iCurrencyUnits = 0;
		
		for(var i = 0; i <iPowerupCount ; i++)
		{
			bPowerupStatus[i] = false;
			fPowerupTotalDuration[i] = 10.0f;//active time duration of the powerups
		}
	}
    private TextMesh tmPauseCountdown;	//count down numbers after resume
	
	// Use this for initialization
	void Start () 
	{
		//PlayerPrefs.DeleteAll();	//DEBUG
		Application.targetFrameRate = 60;		//ceiling the frame rate on 60 (debug only)
		RenderSettings.fog = true;				//turn on fog on launch
		

        //hMenuScriptCS = (MenuScriptCS)GameObject.Find("MenuGroup").GetComponent(typeof(MenuScriptCS));

		hSoundManagerCS = (SoundManagerCS)GameObject.Find("SoundManager").GetComponent(typeof(SoundManagerCS));
		hControllerScriptCS = (ControllerScriptCS)GetComponent(typeof(ControllerScriptCS));
		hPowerupsMainControllerCS = (PowerupsMainControllerCS)this.GetComponent(typeof(PowerupsMainControllerCS));
		hCameraControllerCS = (CameraControllerCS)GameObject.Find("Main Camera").GetComponent(typeof(CameraControllerCS));
		//hEnemyControllerCS = (EnemyControllerCS)this.GetComponent(typeof(EnemyControllerCS));
		//hMissionsControllerCS = (MissionsControllerCS)this.GetComponent(typeof(MissionsControllerCS));
		//hGlobalAchievementControllerCS = (GlobalAchievementControllerCS)this.GetComponent(typeof(GlobalAchievementControllerCS));
        hHUDControllerCS = GameObject.FindObjectOfType<HUDControllerCS>();
        //((MeshRenderer)GameObject.Find("HUDMainGroup/HUDPauseCounter").GetComponent(typeof(MeshRenderer))).enabled = false;
		
		CurrentEnergy = 100;
		iPauseStatus = 0;
		iDeathStatus = 0;
		iMenuStatus = 1;
		
		bGameOver = false;
		bGamePaused = true;

	}
Exemple #3
0
    // Use this for initialization
    void Start()
    {
        hControllerScriptCS = (ControllerScriptCS)GameObject.Find("Player").GetComponent(typeof(ControllerScriptCS));

        hPlayerSidesColliderScriptCS = (PlayerSidesColliderScriptCS)GameObject.Find("PlayerSidesCollider").GetComponent(typeof(PlayerSidesColliderScriptCS));
        hInGameScriptCS = (InGameScriptCS)GameObject.Find("Player").GetComponent(typeof(InGameScriptCS));
    }
Exemple #4
0
    void Start()
    {
        hControllerScriptCS = (ControllerScriptCS)GameObject.Find("Player").GetComponent(typeof(ControllerScriptCS));
        //	uicControls = (UICheckbox)this.GetComponent(typeof(UICheckbox));

        //check which radio button is this
        if (this.name == "Swipe")
        {
            controlType = ControllerScriptCS.ControlType.Swipe;
        }
        else
        {
            controlType = ControllerScriptCS.ControlType.Gyro;
        }

        //check or uncheck according to type of controls currently enabled
        if (controlType == ControllerScriptCS.ControlType.Swipe)
        {
            //	if (hControllerScriptCS.isSwipeControlEnabled())
            //		uicControls.isChecked = true;
            //	else
            //		uicControls.isChecked = false;
        }
        else if (controlType == ControllerScriptCS.ControlType.Gyro)
        {
            //	if (!hControllerScriptCS.isSwipeControlEnabled())
            //		uicControls.isChecked = true;
            //	else
            //		uicControls.isChecked = false;
        }
    }    //end of start
Exemple #5
0
    private UILabel uilDistanceNotif;           //the distance notification value

    void Start()
    {
        hInGameScriptCS                = (InGameScriptCS)GameObject.Find("Player").GetComponent(typeof(InGameScriptCS));
        hControllerScriptCS            = (ControllerScriptCS)GameObject.Find("Player").GetComponent(typeof(ControllerScriptCS));
        hMissionsControllerCS          = (MissionsControllerCS)GameObject.Find("Player").GetComponent(typeof(MissionsControllerCS));
        hGlobalAchievementControllerCS = (GlobalAchievementControllerCS)GameObject.Find("Player").GetComponent(typeof(GlobalAchievementControllerCS));
        hPowerupsMainControllerCS      = (PowerupsMainControllerCS)GameObject.Find("Player").GetComponent(typeof(PowerupsMainControllerCS));

        uilScoreText    = (UILabel)this.transform.Find("ScoreGroup/Text_Score").GetComponent(typeof(UILabel));                         //the score text on HUD
        uilCurrencyText = (UILabel)this.transform.Find("CurrencyGroup/Text_Currency").GetComponent(typeof(UILabel));                   //the currency text on HUD

        goDistanceNotification       = GameObject.Find("UI Root (2D)/Camera/Anchor/HUDGroup/DistanceNotifier");                        //the distance notification group
        uilDistanceNotif             = (UILabel)this.transform.Find("DistanceNotifier/Text_Distance").GetComponent(typeof(UILabel));   //the text in the distance notification group
        distanceNotifDefaultPosition = goDistanceNotification.transform.position;                                                      //get the default position of the distance notification meter
        goDistanceNotification.transform.position = new Vector3(distanceNotifDefaultPosition.x, 1000, distanceNotifDefaultPosition.z); //remove the distance notification from camera

        tMissionDropDown      = (Transform)this.transform.Find("MissionNotifier").GetComponent(typeof(Transform));                     //the mission description drop down
        uilMissionDescription = (UILabel)this.transform.Find("MissionNotifier/Text_MissionDescription").GetComponent(typeof(UILabel));

        //get time difference to calculate score
        fCurrentTime  = Time.time;
        fPreviousTime = Time.time;

        fPreviousDistance = 0;
        fCurrentDistance  = 0;
        fCurrentTime      = 0;
        fPreviousTime     = 0;
    }    //end of Start
Exemple #6
0
    // Use this for initialization
    void Start()
    {
        //PlayerPrefs.DeleteAll();	//DEBUG
        Application.targetFrameRate = 60;        //ceiling the frame rate on 60 (debug only)

        RenderSettings.fog = true;               //turn on fog on launch

        if (GameObject.Find("MenuGroup"))        //check while type of menu is active (custom or ngui)
        {
            customMenuEnabled = true;
            hMenuScriptCS     = (MenuScriptCS)GameObject.Find("MenuGroup").GetComponent(typeof(MenuScriptCS));
        }
        else
        {
            hNGUIMenuScript = (NGUIMenuScript)GameObject.Find("UI Root (2D)").GetComponent(typeof(NGUIMenuScript));
        }

        hSoundManagerCS                = (SoundManagerCS)GameObject.Find("SoundManager").GetComponent(typeof(SoundManagerCS));
        hControllerScriptCS            = (ControllerScriptCS)this.GetComponent(typeof(ControllerScriptCS));
        hPowerupsMainControllerCS      = (PowerupsMainControllerCS)this.GetComponent(typeof(PowerupsMainControllerCS));
        hCameraControllerCS            = (CameraControllerCS)GameObject.Find("Main Camera").GetComponent(typeof(CameraControllerCS));
        hEnemyControllerCS             = (EnemyControllerCS)this.GetComponent(typeof(EnemyControllerCS));
        hMissionsControllerCS          = (MissionsControllerCS)this.GetComponent(typeof(MissionsControllerCS));
        hGlobalAchievementControllerCS = (GlobalAchievementControllerCS)this.GetComponent(typeof(GlobalAchievementControllerCS));

        CurrentEnergy = 100;
        iPauseStatus  = 0;
        iDeathStatus  = 0;
        iMenuStatus   = 1;

        bGameOver   = false;
        bGamePaused = true;
    }
	void Start()
	{
		tPlayer = GameObject.Find("Player").transform;
		bPitFallingStart = false;
		
		hInGameScriptCS = (InGameScriptCS)GetComponent(typeof(InGameScriptCS));
		hControllerScriptCS = (ControllerScriptCS)GetComponent(typeof(ControllerScriptCS));
	}
    void Start()
    {
        tPlayer          = GameObject.Find("Player").transform;
        bPitFallingStart = false;

        hInGameScriptCS     = (InGameScriptCS)this.GetComponent(typeof(InGameScriptCS));
        hControllerScriptCS = (ControllerScriptCS)this.GetComponent(typeof(ControllerScriptCS));
    }
    void Start()
    {
        tPlayer = GameObject.Find("Player").transform;
        tEnemy  = this.transform;

        hInGameScriptCS     = (InGameScriptCS)GameObject.Find("Player").GetComponent(typeof(InGameScriptCS));
        hControllerScriptCS = (ControllerScriptCS)GameObject.Find("Player").GetComponent(typeof(ControllerScriptCS));
        hSoundManagerCS     = (SoundManagerCS)GameObject.Find("SoundManager").GetComponent(typeof(SoundManagerCS));
    }
	void Start()
	{
		WaypointAngle = 0.0f;
		fPathLength = defaultPathLength;
		fNextPathLength = defaultPathLength;
		CurrentPercent = 0.0f;
		
		hInGameScriptCS = (InGameScriptCS)this.GetComponent(typeof(InGameScriptCS));
		hControllerScriptCS = (ControllerScriptCS)this.GetComponent(typeof(ControllerScriptCS));
		hPatchesRandomizerCS = (PatchesRandomizerCS)this.GetComponent(typeof(PatchesRandomizerCS));
		hElementsGeneratorCS = (ElementsGeneratorCS)this.GetComponent(typeof(ElementsGeneratorCS));
	}
Exemple #11
0
    void Start()
    {
        WaypointAngle   = 0.0f;
        fPathLength     = defaultPathLength;
        fNextPathLength = defaultPathLength;
        CurrentPercent  = 0.0f;

        hInGameScriptCS      = (InGameScriptCS)this.GetComponent(typeof(InGameScriptCS));
        hControllerScriptCS  = (ControllerScriptCS)this.GetComponent(typeof(ControllerScriptCS));
        hPatchesRandomizerCS = (PatchesRandomizerCS)this.GetComponent(typeof(PatchesRandomizerCS));
        //hElementsGeneratorCS = (ElementsGeneratorCS)this.GetComponent(typeof(ElementsGeneratorCS));
    }
Exemple #12
0
    private float fCamShakeImpulse = 0.0f;  //Camera Shake Impulse

    void Start()
    {
        tCamera     = this.camera.transform;
        tPlayerMesh = GameObject.Find("PlayerRotation/PlayerMesh").transform;
        tPlayer     = GameObject.Find("Player").transform;

        hInGameScriptCS     = (InGameScriptCS)GameObject.Find("Player").GetComponent(typeof(InGameScriptCS));
        hControllerScriptCS = (ControllerScriptCS)GameObject.Find("Player").GetComponent(typeof(ControllerScriptCS));

        fCameraRotationX = tCamera.localEulerAngles.x;
        fCameraRotationZ = tCamera.localEulerAngles.z;

        iCameraState     = 0;
        fCamShakeImpulse = 0.0f;
    }
	private float fCamShakeImpulse = 0.0f;	//Camera Shake Impulse
	
	void Start()
	{
		tCamera = this.GetComponent<Camera>().transform;
		tPlayerMesh = GameObject.Find("PlayerRotation/PlayerMesh").transform;
		tPlayer = GameObject.Find("Player").transform;
		
		hInGameScriptCS = (InGameScriptCS)GameObject.Find("Player").GetComponent(typeof(InGameScriptCS));		
		hControllerScriptCS = (ControllerScriptCS)GameObject.Find("Player").GetComponent(typeof(ControllerScriptCS));
				
		fCameraRotationX = tCamera.localEulerAngles.x;
		fCameraRotationZ = tCamera.localEulerAngles.z;
		
		iCameraState = 0;	
		fCamShakeImpulse = 0.0f;
	}
Exemple #14
0
    void Start()
    {
        hControllerScriptCS = (ControllerScriptCS)GameObject.Find("Player").GetComponent(typeof(ControllerScriptCS));
        hInGameScriptCS     = (InGameScriptCS)GameObject.Find("Player").GetComponent(typeof(InGameScriptCS));
        hControllerScriptCS = (ControllerScriptCS)GameObject.Find("Player").GetComponent(typeof(ControllerScriptCS));

        stopAllSounds();

        if (bMusicEnabled == true)
        {
            asMusic [0].Play();
        }
        else
        {
            asMusic [0].Stop();
        }
    }
	void Start()
	{

        go_MainMenu = GameObject.Find("Canvas/pnl_MainMenu");
        go_GameMenu = GameObject.Find("Canvas/pnl_GameMenu");
        go_PauseMenu = GameObject.Find("Canvas/pnl_PauseMenu");
        go_GameOverMenu = GameObject.Find("Canvas/pnl_GameOverMenu");

		hInGameScriptCS = (InGameScriptCS)GameObject.Find("Player").GetComponent(typeof(InGameScriptCS));
		hControllerScriptCS = (ControllerScriptCS)GameObject.Find("Player").GetComponent(typeof(ControllerScriptCS));
		//hMissionsControllerCS = (MissionsControllerCS)GameObject.Find("Player").GetComponent(typeof(MissionsControllerCS));
		//hGlobalAchievementControllerCS = (GlobalAchievementControllerCS)GameObject.Find("Player").GetComponent(typeof(GlobalAchievementControllerCS));
		hPowerupsMainControllerCS = (PowerupsMainControllerCS)GameObject.Find("Player").GetComponent(typeof(PowerupsMainControllerCS));
	
		//tMissionDropDown = this.transform.Find("HUDGroup/MissionNotifier");
		//missionDescription = tMissionDropDown.Find("Text_MissionDescription").GetComponent("TextMesh") as TextMesh;
        //txHUDCurrencyText = GameObject.Find("Canvas/pnl_GameMenu/Currency/txt_currency").GetComponent<Text>();
        //txHUDScoreText = GameObject.Find("Canvas/pnl_GameMenu/Score/txt_score").GetComponent<Text>();			
		//tHUDScoreContainerMid = (Transform)GameObject.Find("HUDMainGroup/HUDGroup/HUDScoreGroup/HUD_Score_BG").GetComponent(typeof(Transform));	//	HUD Score Container	
		//tHUDCurrencyContainerMid = (Transform)GameObject.Find("HUDMainGroup/HUDGroup/HUDCurrencyGroup/HUD_Currency_BG").GetComponent(typeof(Transform));	//	HUD Currency Container
		//tHUDScoreContainerMid.localScale = new Vector3(tHUDScoreContainerMid.localScale.x, tHUDScoreContainerMid.localScale.y, 0.45f);
		//tHUDCurrencyContainerMid.localScale = new Vector3(tHUDCurrencyContainerMid.localScale.x, tHUDCurrencyContainerMid.localScale.y, 0.45f);
					
		//Distance Notification
		//txtDistanceNotif = GameObject.Find("Canvas/pnl_GameMenu/DistanceNotifier/txt_distanceNotif").GetComponent("Text") as Text;
        //tDistanceNotification = (RectTransform)GameObject.Find("Canvas/pnl_GameMenu/DistanceNotifier").GetComponent(typeof(RectTransform));
		tDistanceNotification.gameObject.SetActive(false);
						
		//get time difference to calculate score
		fCurrentTime = Time.time;
		fPreviousTime = Time.time;
		
		fPreviousDistance = 0;
		fCurrentDistance = 0;
		fCurrentTime = 0;
		fPreviousTime = 0;
		
		iDivisorScore = 10;
		iDivisorCurrency = 10;
		iDivisorMultiplier = 10;
		
		//call the resize Dight Container function every .5 seconds
		//InvokeRepeating("resizeDigitContainer", 1, 0.5f);
		//resizeDigitContainer();
	}
    private UISlider uisHUDPUMeter;   //the power-up meter in the NGUI menus

    void Start()
    {
        tPlayer = transform;

        //powerup meter visual
        iPowerupCount = PowerUps.GetValues(typeof(PowerUps)).Length - 1;      //get the total number of powerups

        bPowerupStatus        = new bool[iPowerupCount];
        fPowerupStartTime     = new float[iPowerupCount];
        fPowerupTotalDuration = new float[iPowerupCount];

        hInGameScriptCS                = (InGameScriptCS)this.GetComponent(typeof(InGameScriptCS));
        hControllerScriptCS            = (ControllerScriptCS)this.GetComponent(typeof(ControllerScriptCS));
        hSoundManagerCS                = (SoundManagerCS)GameObject.Find("SoundManager").GetComponent(typeof(SoundManagerCS));
        hMissionsControllerCS          = (MissionsControllerCS)this.GetComponent(typeof(MissionsControllerCS));
        hGlobalAchievementControllerCS = (GlobalAchievementControllerCS)this.GetComponent(typeof(GlobalAchievementControllerCS));
        hPlayerFrontColliderScriptCS   = (PlayerFrontColliderScriptCS)GameObject.Find("PlayerFrontCollider").GetComponent(typeof(PlayerFrontColliderScriptCS));
        hPlayerSidesColliderScriptCS   = (PlayerSidesColliderScriptCS)GameObject.Find("PlayerSidesCollider").GetComponent(typeof(PlayerSidesColliderScriptCS));

        //check which type of menu (Custom or NGUI) to work with
        if (hInGameScriptCS.isCustomMenuEnabled())
        {
            tHUDPUMeter    = (Transform)GameObject.Find("HUDMainGroup/HUDPUMeter").GetComponent(typeof(Transform));
            tHUDPUMeterBar = (Transform)GameObject.Find("HUDMainGroup/HUDPUMeter/HUD_PU_Meter_Bar_Parent").GetComponent(typeof(Transform));
            tHUDPUMeter.transform.position -= new Vector3(0, 100, 0);            //hide the powerup meter
        }
        else
        {
            uisHUDPUMeter = (UISlider)GameObject.Find("UI Root (2D)/Camera/Anchor/HUDGroup/PowerupMeter/Progress Bar").GetComponent(typeof(UISlider));
            uisHUDPUMeter.transform.position = new Vector3(0, 1000, 0);          //hide the power-up meter by default
        }

        fMagnetismDefaultRadius = 200;
        fMangetismRadius        = 200;          //default: pull currency toward the character
        iCurrencyUnits          = 0;

        for (var i = 0; i < iPowerupCount; i++)
        {
            bPowerupStatus[i]        = false;
            fPowerupTotalDuration[i] = 10.0f;            //active time duration of the powerups
        }
    }
Exemple #17
0
    void Start()
    {
        hInGameScriptCS                = (InGameScriptCS)GameObject.Find("Player").GetComponent(typeof(InGameScriptCS));
        hControllerScriptCS            = (ControllerScriptCS)GameObject.Find("Player").GetComponent(typeof(ControllerScriptCS));
        hMissionsControllerCS          = (MissionsControllerCS)GameObject.Find("Player").GetComponent(typeof(MissionsControllerCS));
        hGlobalAchievementControllerCS = (GlobalAchievementControllerCS)GameObject.Find("Player").GetComponent(typeof(GlobalAchievementControllerCS));
        hPowerupsMainControllerCS      = (PowerupsMainControllerCS)GameObject.Find("Player").GetComponent(typeof(PowerupsMainControllerCS));

        tMissionDropDown                    = this.transform.Find("HUDGroup/MissionNotifier");
        missionDescription                  = tMissionDropDown.Find("Text_MissionDescription").GetComponent("TextMesh") as TextMesh;
        tmHUDCurrencyText                   = GameObject.Find("HUDMainGroup/HUDGroup/HUDCurrencyGroup/HUD_Currency_Text").GetComponent("TextMesh") as TextMesh;
        tmHUDScoreText                      = GameObject.Find("HUDMainGroup/HUDGroup/HUDScoreGroup/HUD_Score_Text").GetComponent("TextMesh") as TextMesh;
        tHUDScoreContainerMid               = (Transform)GameObject.Find("HUDMainGroup/HUDGroup/HUDScoreGroup/HUD_Score_BG").GetComponent(typeof(Transform));       //	HUD Score Container
        tHUDCurrencyContainerMid            = (Transform)GameObject.Find("HUDMainGroup/HUDGroup/HUDCurrencyGroup/HUD_Currency_BG").GetComponent(typeof(Transform)); //	HUD Currency Container
        tHUDScoreContainerMid.localScale    = new Vector3(tHUDScoreContainerMid.localScale.x, tHUDScoreContainerMid.localScale.y, 0.45f);
        tHUDCurrencyContainerMid.localScale = new Vector3(tHUDCurrencyContainerMid.localScale.x, tHUDCurrencyContainerMid.localScale.y, 0.45f);

        //Distance Notification
        tmDistanceNotif       = GameObject.Find("HUDMainGroup/HUDGroup/DistanceNotifier/Text_Distance").GetComponent("TextMesh") as TextMesh;
        tDistanceNotification = (Transform)GameObject.Find("HUDMainGroup/HUDGroup/DistanceNotifier").GetComponent(typeof(Transform));
        tDistanceNotification.gameObject.SetActive(false);

        //get time difference to calculate score
        fCurrentTime  = Time.time;
        fPreviousTime = Time.time;

        fPreviousDistance = 0;
        fCurrentDistance  = 0;
        fCurrentTime      = 0;
        fPreviousTime     = 0;

        iDivisorScore      = 10;
        iDivisorCurrency   = 10;
        iDivisorMultiplier = 10;

        //call the resize Dight Container function every .5 seconds
        InvokeRepeating("resizeDigitContainer", 1, 0.5f);
        resizeDigitContainer();
    }
Exemple #18
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
    }
	void Start ()
	{
		hControllerScriptCS = (ControllerScriptCS)GameObject.Find ("Player").GetComponent (typeof(ControllerScriptCS));
		hInGameScriptCS = (InGameScriptCS)GameObject.Find ("Player").GetComponent (typeof(InGameScriptCS));
		hControllerScriptCS = (ControllerScriptCS)GameObject.Find ("Player").GetComponent (typeof(ControllerScriptCS));
		
		stopAllSounds ();
		
		if (bMusicEnabled == true)
			asMusic [0].Play ();
		else
			asMusic [0].Stop ();
	}
Exemple #20
0
 // Use this for initialization
 void Start()
 {
     hControllerScriptCS = (ControllerScriptCS)GameObject.Find("Player").GetComponent(typeof(ControllerScriptCS));
 }
	void Start()
	{		
		hInGameScriptCS = (InGameScriptCS)GameObject.Find("Player").GetComponent(typeof(InGameScriptCS));
		hPlayerFrontColliderScriptCS = (PlayerFrontColliderScriptCS)GameObject.Find("PlayerFrontCollider").GetComponent(typeof(PlayerFrontColliderScriptCS));
		hControllerScriptCS = (ControllerScriptCS)GameObject.Find("Player").GetComponent(typeof(ControllerScriptCS));
	}