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
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 }
// 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)); }
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 } }
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; bPitFallingStart = false; hInGameScriptCS = (InGameScriptCS)GetComponent(typeof(InGameScriptCS)); hControllerScriptCS = (ControllerScriptCS)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)); }
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)); }
void Start() { hInGameScriptCS = (InGameScriptCS)GameObject.Find("Player").GetComponent(typeof(InGameScriptCS)); hNGUIMenuScript = (NGUIMenuScript)GameObject.Find("UI Root (2D)").GetComponent(typeof(NGUIMenuScript)); if (itemCost <= 0) { Debug.Log("EXCEPTION: No cost assigned to the Utility shop element. Check the user documentation."); } uilCost = (UILabel)this.transform.Find("Text_Cost").GetComponent(typeof(UILabel)); uilCost.text = itemCost.ToString(); //cost of the utility displayed in shop }
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; }
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; }
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 }
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(); }
void Start() { hInGameScriptCS = (InGameScriptCS)this.GetComponent(typeof(InGameScriptCS)); hCheckPointsMainCS = (CheckPointsMainCS)GetComponent(typeof(CheckPointsMainCS)); hElementsGeneratorCS = (ElementsGeneratorCS)this.GetComponent(typeof(ElementsGeneratorCS)); iCurrentPNum = 1; fPreviousTotalDistance = 0.0f; fPatchDistance = hCheckPointsMainCS.getDefaultPathLength(); instantiateStartPatch(); goPreviousPatch = goCurrentPatch; tPlayer = GameObject.Find("Player").transform; hCheckPointsMainCS.setChildGroups(); hCheckPointsMainCS.SetCurrentPatchCPs(); hCheckPointsMainCS.SetNextPatchCPs(); }
void Start() { //scirpt references hInGameScriptCS = (InGameScriptCS)GameObject.Find("Player").GetComponent(typeof(InGameScriptCS)); hNGUIHUDScript = (NGUIHUDScript)this.transform.Find("Camera/Anchor/HUDGroup").GetComponent(typeof(NGUIHUDScript)); //get the total number of menus used iMenuCount = System.Enum.GetValues(typeof(NGUIMenus)).Length; goHUDGroup = GameObject.Find("Camera/Anchor/HUDGroup"); //gameobject of the HUD Group //get the gameobjects of all menus used for later access goNGUIMenus = new GameObject[iMenuCount]; goNGUIMenus[(int)NGUIMenus.MainMenu] = GameObject.Find("Camera/Anchor/MainMenu"); goNGUIMenus[(int)NGUIMenus.PauseMenu] = GameObject.Find("Camera/Anchor/PauseMenu"); goNGUIMenus[(int)NGUIMenus.GameOverMenu] = GameObject.Find("Camera/Anchor/GameOverMenu"); goNGUIMenus[(int)NGUIMenus.InstructionsMenu] = GameObject.Find("Camera/Anchor/InstructionsMenu"); goNGUIMenus[(int)NGUIMenus.SettingsMenu] = GameObject.Find("Camera/Anchor/SettingsMenu"); goNGUIMenus[(int)NGUIMenus.MissionsMenu] = GameObject.Find("Camera/Anchor/MissionsMenu"); goNGUIMenus[(int)NGUIMenus.AchievementsMenu] = GameObject.Find("Camera/Anchor/AchievementsMenu"); goNGUIMenus[(int)NGUIMenus.ShopHome] = GameObject.Find("Camera/Anchor/Shop/ShopHome"); goNGUIMenus[(int)NGUIMenus.ShopCostumes] = GameObject.Find("Camera/Anchor/Shop/ShopCostumes"); goNGUIMenus[(int)NGUIMenus.ShopIAPs] = GameObject.Find("Camera/Anchor/Shop/ShopIAPs"); goNGUIMenus[(int)NGUIMenus.ShopPowerups] = GameObject.Find("Camera/Anchor/Shop/ShopPowerups"); goNGUIMenus[(int)NGUIMenus.ShopUtilities] = GameObject.Find("Camera/Anchor/Shop/ShopUtilities"); for (int i = 0; i < iMenuCount; i++) //disable all menu groups when game starts { NGUITools.SetActive(goNGUIMenus[i], false); } uilAchievementsText = (UILabel)goNGUIMenus[(int)NGUIMenus.AchievementsMenu].transform. Find("Text_Achievements").GetComponent(typeof(UILabel)); uilPauseCounter = (UILabel)this.transform.Find("Camera/Anchor/Text_PauseCounter").GetComponent(typeof(UILabel)); NGUITools.SetActive(uilPauseCounter.gameObject, false); uilMissionPauseMenuText = (UILabel)goNGUIMenus[(int)NGUIMenus.PauseMenu].transform.Find("Text_Missions").GetComponent(typeof(UILabel)); uilMissionMissionMenuText = (UILabel)goNGUIMenus[(int)NGUIMenus.MissionsMenu].transform.Find("Text_Missions").GetComponent(typeof(UILabel)); ShowMenu(NGUIMenus.MainMenu); //display main menu when game starts toggleHUDGroupState(false); } //end of Start function
void Start() { HUDCamera = (Camera)GameObject.Find("HUDMainGroup/HUDCamera").GetComponent(typeof(Camera)); hMenuScriptCS = (MenuScriptCS)GameObject.Find("MenuGroup").GetComponent(typeof(MenuScriptCS)); hInGameScriptCS = (InGameScriptCS)GameObject.Find("Player").GetComponent(typeof(InGameScriptCS)); hSoundManagerCS = (SoundManagerCS)GameObject.Find("SoundManager").GetComponent(typeof(SoundManagerCS)); tShopMenuTransforms = new Transform[ShopMenus.GetValues(typeof(ShopMenus)).Length]; tShopMenuTransforms[(int)ShopMenus.ShopHome] = (Transform)this.transform.Find("ShopHome").GetComponent(typeof(Transform)); //shop primary menu tShopHomeButtons = new Transform[iShopHomeButtonCount]; tShopHomeButtons[0] = (Transform)tShopMenuTransforms[(int)ShopMenus.ShopHome].Find("Buttons/Button_Back").GetComponent(typeof(Transform)); tShopHomeButtons[1] = (Transform)tShopMenuTransforms[(int)ShopMenus.ShopHome].Find("Buttons/Button_Costumes").GetComponent(typeof(Transform)); tShopHomeButtons[2] = (Transform)tShopMenuTransforms[(int)ShopMenus.ShopHome].Find("Buttons/Button_Powerups").GetComponent(typeof(Transform)); tShopHomeButtons[3] = (Transform)tShopMenuTransforms[(int)ShopMenus.ShopHome].Find("Buttons/Button_Utilities").GetComponent(typeof(Transform)); tShopHomeButtons[4] = (Transform)tShopMenuTransforms[(int)ShopMenus.ShopHome].Find("Buttons/Button_MoreCoins").GetComponent(typeof(Transform)); //shop costumes menu tShopMenuTransforms[(int)ShopMenus.Costumes] = (Transform)this.transform.Find("CostumesShop").GetComponent(typeof(Transform)); tShopCostumesButtons = new Transform[iShopCostumesButtonCount]; tShopCostumesButtons[0] = (Transform)tShopMenuTransforms[(int)ShopMenus.Costumes].Find("Button_Back").GetComponent(typeof(Transform)); //shop powerups menu tShopMenuTransforms[(int)ShopMenus.Powerups] = (Transform)this.transform.Find("PowerupsShop").GetComponent(typeof(Transform)); tShopPowerupsButtons = new Transform[iShopPowerupsButtonsCount]; tShopPowerupsButtons[0] = (Transform)tShopMenuTransforms[(int)ShopMenus.Powerups].Find("Button_Back").GetComponent(typeof(Transform)); //shop utilities menu tShopMenuTransforms[(int)ShopMenus.Utilities] = (Transform)this.transform.Find("UtilitiesShop").GetComponent(typeof(Transform)); tShopUtilitiesButtons = new Transform[iShopUtilitiesButtonCount]; tShopUtilitiesButtons[0] = (Transform)tShopMenuTransforms[(int)ShopMenus.Utilities].Find("Button_Back").GetComponent(typeof(Transform)); //shop IAP tShopMenuTransforms[(int)ShopMenus.IAPs] = (Transform)this.transform.Find("MoreCoinsShop").GetComponent(typeof(Transform)); tShopIAPButtons = new Transform[iShopIAPButtonsCount]; tShopIAPButtons[0] = (Transform)tShopMenuTransforms[(int)ShopMenus.IAPs].Find("Button_Back").GetComponent(typeof(Transform)); //vertical scroll initilization iScrollState = 0; setShopScriptEnabled(false); }
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 } }
void Start() { hNGUIMenuScript = (NGUIMenuScript)GameObject.Find("UI Root (2D)").GetComponent(typeof(NGUIMenuScript)); 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."); } uilCost = (UILabel)this.transform.Find("Text_Cost").GetComponent(typeof(UILabel)); uilReward = (UILabel)this.transform.Find("Text_Reward").GetComponent(typeof(UILabel)); uilCost.text = "$ " + itemCost.ToString(); //display the cost of the item uilReward.text = itemReward.ToString(); //display the virtual currency reward }
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 }
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; }
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(); }
void Start() { hInGameScriptCS = (InGameScriptCS)GameObject.Find("Player").GetComponent(typeof(InGameScriptCS)); hNGUIMenuScript = (NGUIMenuScript)GameObject.Find("UI Root (2D)").GetComponent(typeof(NGUIMenuScript)); goBuyEquipButton = (GameObject)this.transform.Find("Button_BuyEquip").gameObject; uilBuyEquipButton = (UILabel)this.transform.Find("Button_BuyEquip/Label").GetComponent(typeof(UILabel)); uilCostDescription = (UILabel)this.transform.Find("Text_Cost").GetComponent(typeof(UILabel)); //check if a meterial, texture and cost has been assigned to exposed variables 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."); } //is this the currently applied texture? if (characterMaterial.GetTexture("_MainTex") == characterCostume) { costumeOwned = true; uilBuyEquipButton.text = "EQUIP"; } else //not the currently equiped texture { costumeOwned = false; uilBuyEquipButton.text = "BUY"; } //set the price on the label uilCostDescription.text = costumeCost.ToString(); } //end of Start
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 }
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()
void Start() { hPlayerSidesColliderScriptCS = (PlayerSidesColliderScriptCS)GameObject.Find("PlayerSidesCollider").GetComponent(typeof(PlayerSidesColliderScriptCS)); hInGameScriptCS = (InGameScriptCS)GameObject.Find("Player").GetComponent(typeof(InGameScriptCS)); }
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)); }
void Start() { hInGameScriptCS = (InGameScriptCS)GameObject.Find("Player").GetComponent(typeof(InGameScriptCS)); }
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()
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() { hNGUIMenuScript = (NGUIMenuScript)GameObject.Find("UI Root (2D)").GetComponent(typeof(NGUIMenuScript)); hInGameScriptCS = (InGameScriptCS)GameObject.Find("Player").GetComponent(typeof(InGameScriptCS)); }
private int[] achievementsProgress; //store the current progress of achievements void Start() { achievementsProgress = new int[System.Enum.GetValues(typeof(GlobalAchievementTypes)).Length]; hInGameScriptCS = (InGameScriptCS)this.GetComponent(typeof(InGameScriptCS)); if (hInGameScriptCS.isCustomMenuEnabled()) { hMenuScriptCS = (MenuScriptCS)GameObject.Find("MenuGroup").GetComponent(typeof(MenuScriptCS)); } else { hNGUIMenuScript = (NGUIMenuScript)GameObject.Find("UI Root (2D)").GetComponent(typeof(NGUIMenuScript)); } //get the GlobalAchievementsList file from the resources folder TextAsset taFile = (TextAsset)Resources.Load("GlobalAchievementsList"); string[] lines = taFile.text.Split('\n'); if (lines.Length == 0) //if the file was empty { Debug.Log("No achievements found in file"); this.enabled = false; } else //read file and extract achievements detail { int lineIndex = 0; int arrayIndex = 0; iTotalAchievementsCount = lines.Length / 3; //get the total number of achievements in the file achievements = new GlobalAchievementDetail[iTotalAchievementsCount]; //allocate memory according to the number of achievement /*for (var i=0; i<iTotalAchievementsCount; i++) * achievements[i] = new GlobalAchievementDetail();*/ while (lineIndex < lines.Length) //store the file content in achievement array { achievements[arrayIndex].achievementDescription = lines[lineIndex++].ToString(); achievements[arrayIndex].achievementCount = int.Parse(lines[lineIndex++].ToString()); achievements[arrayIndex].achievementType = (GlobalAchievementTypes)System.Enum.Parse(typeof(GlobalAchievementTypes), lines[lineIndex++].ToString()); achievements[arrayIndex].achievementComplete = false; //mark achievement incomplete by default if (PlayerPrefs.HasKey("GlobalAchievement_" + arrayIndex)) //check achievement progress { achievementsProgress[(int)achievements[arrayIndex].achievementType] = PlayerPrefs.GetInt("GlobalAchievement_" + arrayIndex); //check if the achievement has been completed if (achievementsProgress[(int)achievements[arrayIndex].achievementType] >= achievements[arrayIndex].achievementCount) { achievements[arrayIndex].achievementComplete = true; } } else //if this is the first game launch { PlayerPrefs.SetInt("GlobalAchievement_" + arrayIndex, 0); achievementsProgress[(int)achievements[arrayIndex].achievementType] = 0; } arrayIndex++; } //end of while updateMenuDescription(); } //end of else PlayerPrefs.Save(); }
void Start() { iActiveMissionCount = 3; //three missions active at a time by deafult missionsProgress = new int[System.Enum.GetValues(typeof(MissionTypes)).Length]; //set the next mission index if (PlayerPrefs.HasKey("NextMissionIndex")) { iNextMission = PlayerPrefs.GetInt("NextMissionIndex"); } else { iNextMission = 0; PlayerPrefs.SetInt("NextMissionIndex", iNextMission); } hInGameScriptCS = (InGameScriptCS)this.GetComponent(typeof(InGameScriptCS)); if (hInGameScriptCS.isCustomMenuEnabled()) { hMenuScriptCS = (MenuScriptCS)GameObject.Find("MenuGroup").GetComponent(typeof(MenuScriptCS)); hHUDControllerCS = (HUDControllerCS)GameObject.Find("HUDMainGroup").GetComponent(typeof(HUDControllerCS)); } else { hNGUIMenuScript = (NGUIMenuScript)GameObject.Find("UI Root (2D)").GetComponent(typeof(NGUIMenuScript)); hNGUIHUDScript = hNGUIMenuScript.getNGUIHUDScriptReference(); } //get the MissionList file from the resources folder TextAsset taFile = (TextAsset)Resources.Load("MissionsList"); string[] lines = taFile.text.Split('\n'); if (lines.Length == 0) //if the file was empty { Debug.Log("No missions found in file"); this.enabled = false; } else //read file and extract mission detail { int lineIndex = 0; int arrayIndex = 0; iTotalMissionCount = lines.Length / 3; missions = new MissionDetail[iTotalMissionCount]; //allocate memory according to the number of missions for (int i = 0; i < iTotalMissionCount; i++) { missions[i] = new MissionDetail(); } while (lineIndex < lines.Length) //store the file content in mission array { missions[arrayIndex].missionDescription = lines[lineIndex++]; missions[arrayIndex].missionCount = int.Parse(lines[lineIndex++]); missions[arrayIndex].missionType = (MissionTypes)System.Enum.Parse(typeof(MissionTypes), lines[lineIndex++]); arrayIndex++; } //end of while iActiveMissions = new int[iActiveMissionCount]; for (int i = 0; i < iActiveMissionCount; i++) //set the currently active missions { if (PlayerPrefs.HasKey("ActiveMission_" + i.ToString())) { iActiveMissions[i] = PlayerPrefs.GetInt("ActiveMission_" + i.ToString()); } else { iActiveMissions[i] = getNextMission(); PlayerPrefs.SetInt("ActiveMission_" + i.ToString(), iActiveMissions[i]); } } //end of for updateMenuDescriptions(); } //end of else PlayerPrefs.Save(); }
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 }