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;

	}
示例#2
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;
    }
示例#3
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
示例#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));
        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
    }
示例#5
0
    void Start()
    {
        iObstacleCount = obstaclePrefabs.Length;
        iPowerupCount  = powerupPrefabs.Length;
        iTotalCount    = iObstacleCount + iPowerupCount + 1;     //obstacles + powerups + currency

        bGenerateElements = true;
        bPowerupPlaced    = true;     //do not place powerup on first patch
        System.DateTime dt = System.DateTime.Now;
        Random.seed = dt.Hour * dt.Minute * dt.Second;

        setPrefabHandlers();

        hPowerupsMainControllerCS = (PowerupsMainControllerCS)this.GetComponent(typeof(PowerupsMainControllerCS));
        hCheckPointsMainCS        = (CheckPointsMainCS)GameObject.Find("Player").GetComponent(typeof(CheckPointsMainCS));
        hPatchesRandomizerCS      = (PatchesRandomizerCS)this.GetComponent(typeof(PatchesRandomizerCS));

        //generate elements on first patch
        float i = 0.20f;

        while (i < 0.99f)
        {
            float incrementValue = generateElements(getRandomElement(), i, true); //get any type of element
            i += incrementValue;
        }                                                                         //end of while
    }                                                                             //end of Start()
	void Start()
	{
		iObstacleCount = obstaclePrefabs.Length;
		iPowerupCount = powerupPrefabs.Length;
		iTotalCount = iObstacleCount + iPowerupCount + 1;//obstacles + powerups + currency
		
		bGenerateElements = true;
		bPowerupPlaced = true;//do not place powerup on first patch
		System.DateTime dt = System.DateTime.Now;
		Random.seed = dt.Hour * dt.Minute * dt.Second;
		
		setPrefabHandlers();
		
		hPowerupsMainControllerCS = (PowerupsMainControllerCS)this.GetComponent(typeof(PowerupsMainControllerCS));
		hCheckPointsMainCS = (CheckPointsMainCS)GameObject.Find("Player").GetComponent(typeof(CheckPointsMainCS));
		hPatchesRandomizerCS = (PatchesRandomizerCS)this.GetComponent(typeof(PatchesRandomizerCS));
		
		//generate elements on first patch
		float i = 0.20f;
		while (i < 0.99f)
		{	
			float incrementValue = generateElements(getRandomElement(), i, true);//get any type of element
			i += incrementValue;
		}//end of while		
	}//end of Start()
	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();
	}
示例#8
0
    void Start()
    {
        uilLevelText = (UILabel)this.transform.Find("Text_ItemLevel").GetComponent(typeof(UILabel));

        hInGameScriptCS           = (InGameScriptCS)GameObject.Find("Player").GetComponent(typeof(InGameScriptCS));
        hNGUIMenuScript           = (NGUIMenuScript)GameObject.Find("UI Root (2D)").GetComponent(typeof(NGUIMenuScript));
        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.");
        }

        uilUpgradeCost      = (UILabel)this.transform.Find("Text_Cost").GetComponent(typeof(UILabel));
        uilUpgradeCost.text = upgradeCost.ToString();        //set the cost of the item as specified by the user

        currentPowerupLevel = 1;
    }
示例#9
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();
    }
示例#10
0
 void Start()
 {
     tPlayer                   = GameObject.Find("Player").transform;
     hInGameScriptCS           = (InGameScriptCS)GameObject.Find("Player").GetComponent(typeof(InGameScriptCS));
     hPowerupsMainControllerCS = (PowerupsMainControllerCS)GameObject.Find("Player").GetComponent(typeof(PowerupsMainControllerCS));
 }
	void Start()
	{
		tPlayer = GameObject.Find("Player").transform;		
		hInGameScriptCS = (InGameScriptCS)GameObject.Find("Player").GetComponent(typeof(InGameScriptCS));
		hPowerupsMainControllerCS = (PowerupsMainControllerCS)GameObject.Find("Player").GetComponent(typeof(PowerupsMainControllerCS));		
	}
	void Start()
	{
		//script references
		hPatchesRandomizerCS = (PatchesRandomizerCS)this.GetComponent(typeof(PatchesRandomizerCS));
		//hMissionsControllerCS = (MissionsControllerCS)this.GetComponent(typeof(MissionsControllerCS));
		//hGlobalAchievementControllerCS = (GlobalAchievementControllerCS)this.GetComponent(typeof(GlobalAchievementControllerCS));
		hPlayerSidesColliderScriptCS = (PlayerSidesColliderScriptCS)GameObject.Find("PlayerSidesCollider").GetComponent(typeof(PlayerSidesColliderScriptCS));
		hPlayerFrontColliderScriptCS = (PlayerFrontColliderScriptCS)GameObject.Find("PlayerFrontCollider").GetComponent(typeof(PlayerFrontColliderScriptCS));
		hSoundManagerCS = (SoundManagerCS)GameObject.Find("SoundManager").GetComponent(typeof(SoundManagerCS));
		hInGameScriptCS = (InGameScriptCS)this.GetComponent(typeof(InGameScriptCS));
		hPitsMainControllerCS = (PitsMainControllerCS)this.GetComponent(typeof(PitsMainControllerCS));
		hCheckPointsMainCS = (CheckPointsMainCS)this.GetComponent(typeof(CheckPointsMainCS));
		hPowerupScriptCS = (PowerupsMainControllerCS)this.GetComponent(typeof(PowerupsMainControllerCS));
		//hEnemyControllerCS = (EnemyControllerCS)GameObject.Find("Enemy").GetComponent(typeof(EnemyControllerCS));
		hPowerupScriptCS = (PowerupsMainControllerCS)this.GetComponent(typeof(PowerupsMainControllerCS));
		hCameraControllerCS = (CameraControllerCS)GameObject.Find("Main Camera").GetComponent(typeof(CameraControllerCS));
		swipeLogic = (SwipeControlsCS)transform.GetComponent(typeof(SwipeControlsCS));
        //tPlayerMesh = (Transform)GameObject.Find("fatguy_").GetComponent(typeof(Transform));
		
		//check which type of menu (Custom or NGUI) to work with
		if (hInGameScriptCS.isCustomMenuEnabled())
		{
			//hMenuScriptCS = (MenuScriptCS)GameObject.Find("MenuGroup").GetComponent(typeof(MenuScriptCS));
			HUDCamera = GameObject.Find("HUDCamera").GetComponent<Camera>();
			
			tHUDGroup = GameObject.Find("HUDMainGroup/HUDGroup").transform;
			tPauseButton = GameObject.Find("HUDMainGroup/HUDGroup/HUDPause").transform;
		}
		
		tPlayer = transform;
		tPlayerRotation = transform.Find("PlayerRotation");
		
		//get the animation component of the player character
		if (this.transform.Find("PlayerRotation/PlayerMesh/Prisoner"))
		{
			mecanimEnabled = false;
			aPlayer = (Animation)this.transform.Find("PlayerRotation/PlayerMesh/Prisoner").GetComponent(typeof(Animation));			
			StartCoroutine("playIdleAnimations");//start playing idle animations
		}
		else if (this.transform.Find("PlayerRotation/PlayerMesh/Prisoner(MecAnim)"))//check for mecanim animated character
		{
			mecanimEnabled = true;
			aPlayerMecAnim = (Animator)this.transform.Find("PlayerRotation/PlayerMesh/Prisoner(MecAnim)").GetComponent(typeof(Animator));
			
			v3DefaultPlayerAnimPosition = aPlayerMecAnim.transform.localPosition;//get the default player position
			v3DefaultPlayerAnimRotation = aPlayerMecAnim.transform.localEulerAngles;//get the default player rotation		
		}
			
		tBlobShadowPlane = transform.Find("BlobShadowPlane");//get the shadow
		
		tPlayerSidesCollider = GameObject.Find("PlayerSidesCollider").transform;//get the sides collider to detect stumbles
		tFrontCollider = GameObject.Find("PlayerFrontCollider").transform;//get the front collider to detect collisions
		
		v3BNCDefaultScale = tFrontCollider.localScale;	
		v3BFCDefaultScale = tPlayerSidesCollider.localScale;
		
		bInAir = false;
		fCurrentDistanceOnPath = 50.0f;	//inital distance with respect to spline
		fCurrentDistance = 0.0f;
		fCurrentMileage = 0.0f;
		tCurrentAngle = 0.0f;	
		fPitFallLerpValue = 0.0f;
		fPitFallForwardSpeed = 0.0f;
		fPitPositionX = 0.0f;
		fDeathAnimStartTime = 0;
		bGroundhit = false;	
		bJumpFlag = false;
		bInJump = false;
		fCurrentUpwardVelocity = 0;
		fCurrentHeight = 0;
		
		bDirectionQueueFlag = false;
		directionQueue = SwipeControlsCS.SwipeDirection.Null;
		iLanePosition = 0;	//set current lane to mid	
		fCurrentWalkSpeed = fStartingWalkSpeed;
		
		//get the type of controls (swipe or gyro) set by user
		if (PlayerPrefs.HasKey("ControlsType"))
			swipeControlsEnabled = PlayerPrefs.GetInt("ControlsType") == 1 ? true : false;
		else
			PlayerPrefs.SetInt("ControlsType", (swipeControlsEnabled == true ? 1 : 0));
			
		//stop footsteps sound if playing
		hSoundManagerCS.stopSound(SoundManagerCS.CharacterSounds.Footsteps);
        stumbledXtimes = 0;
	}//end of Start()
示例#13
0
    void Start()
    {
        //script references
        hPatchesRandomizerCS           = (PatchesRandomizerCS)this.GetComponent(typeof(PatchesRandomizerCS));
        hMissionsControllerCS          = (MissionsControllerCS)this.GetComponent(typeof(MissionsControllerCS));
        hGlobalAchievementControllerCS = (GlobalAchievementControllerCS)this.GetComponent(typeof(GlobalAchievementControllerCS));
        hPlayerSidesColliderScriptCS   = (PlayerSidesColliderScriptCS)GameObject.Find("PlayerSidesCollider").GetComponent(typeof(PlayerSidesColliderScriptCS));
        hPlayerFrontColliderScriptCS   = (PlayerFrontColliderScriptCS)GameObject.Find("PlayerFrontCollider").GetComponent(typeof(PlayerFrontColliderScriptCS));
        hSoundManagerCS       = (SoundManagerCS)GameObject.Find("SoundManager").GetComponent(typeof(SoundManagerCS));
        hInGameScriptCS       = (InGameScriptCS)this.GetComponent(typeof(InGameScriptCS));
        hPitsMainControllerCS = (PitsMainControllerCS)this.GetComponent(typeof(PitsMainControllerCS));
        hCheckPointsMainCS    = (CheckPointsMainCS)this.GetComponent(typeof(CheckPointsMainCS));
        hPowerupScriptCS      = (PowerupsMainControllerCS)this.GetComponent(typeof(PowerupsMainControllerCS));
        hEnemyControllerCS    = (EnemyControllerCS)GameObject.Find("Enemy").GetComponent(typeof(EnemyControllerCS));
        hPowerupScriptCS      = (PowerupsMainControllerCS)this.GetComponent(typeof(PowerupsMainControllerCS));
        hCameraControllerCS   = (CameraControllerCS)GameObject.Find("Main Camera").GetComponent(typeof(CameraControllerCS));
        swipeLogic            = (SwipeControlsCS)transform.GetComponent(typeof(SwipeControlsCS));

        //check which type of menu (Custom or NGUI) to work with
        if (hInGameScriptCS.isCustomMenuEnabled())
        {
            hMenuScriptCS = (MenuScriptCS)GameObject.Find("MenuGroup").GetComponent(typeof(MenuScriptCS));
            HUDCamera     = GameObject.Find("HUDCamera").GetComponent <Camera>();

            tHUDGroup    = GameObject.Find("HUDMainGroup/HUDGroup").transform;
            tPauseButton = GameObject.Find("HUDMainGroup/HUDGroup/HUDPause").transform;
        }

        tPlayer         = transform;
        tPlayerRotation = transform.Find("PlayerRotation");

        //get the animation component of the player character
        if (this.transform.Find("PlayerRotation/PlayerMesh/Prisoner"))
        {
            mecanimEnabled = false;
            aPlayer        = (Animation)this.transform.Find("PlayerRotation/PlayerMesh/Prisoner").GetComponent(typeof(Animation));
            StartCoroutine("playIdleAnimations");                                    //start playing idle animations
        }
        else if (this.transform.Find("PlayerRotation/PlayerMesh/Prisoner(MecAnim)")) //check for mecanim animated character
        {
            mecanimEnabled = true;
            aPlayerMecAnim = (Animator)this.transform.Find("PlayerRotation/PlayerMesh/Prisoner(MecAnim)").GetComponent(typeof(Animator));

            v3DefaultPlayerAnimPosition = aPlayerMecAnim.transform.localPosition;            //get the default player position
            v3DefaultPlayerAnimRotation = aPlayerMecAnim.transform.localEulerAngles;         //get the default player rotation
        }

        tBlobShadowPlane = transform.Find("BlobShadowPlane");                    //get the shadow

        tPlayerSidesCollider = GameObject.Find("PlayerSidesCollider").transform; //get the sides collider to detect stumbles
        tFrontCollider       = GameObject.Find("PlayerFrontCollider").transform; //get the front collider to detect collisions

        v3BNCDefaultScale = tFrontCollider.localScale;
        v3BFCDefaultScale = tPlayerSidesCollider.localScale;

        bInAir = false;
        fCurrentDistanceOnPath = 50.0f;         //inital distance with respect to spline
        fCurrentDistance       = 0.0f;
        fCurrentMileage        = 0.0f;
        tCurrentAngle          = 0.0f;
        fPitFallLerpValue      = 0.0f;
        fPitFallForwardSpeed   = 0.0f;
        fPitPositionX          = 0.0f;
        fDeathAnimStartTime    = 0;
        bGroundhit             = false;
        bJumpFlag = false;
        bInJump   = false;
        fCurrentUpwardVelocity = 0;
        fCurrentHeight         = 0;

        bDirectionQueueFlag = false;
        directionQueue      = SwipeControlsCS.SwipeDirection.Null;
        iLanePosition       = 0;        //set current lane to mid
        fCurrentWalkSpeed   = fStartingWalkSpeed;

        //get the type of controls (swipe or gyro) set by user
        if (PlayerPrefs.HasKey("ControlsType"))
        {
            swipeControlsEnabled = PlayerPrefs.GetInt("ControlsType") == 1 ? true : false;
        }
        else
        {
            PlayerPrefs.SetInt("ControlsType", (swipeControlsEnabled == true ? 1 : 0));
        }

        //stop footsteps sound if playing
        hSoundManagerCS.stopSound(SoundManagerCS.CharacterSounds.Footsteps);
    }    //end of Start()