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; }
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(); }