private void Awake() { SCR_Pool.Flush(); unlockedOrNot = PlayerPrefs.GetInt("Unlocked"); if (unlockedOrNot == 0) { for (int i = 1; i <= cars.Length - 1; i++) { carsUnlockedOrNot[i] = false; } } else if (unlockedOrNot == 1) { for (int i = 0; i <= cars.Length - 1; i++) { carsUnlockedOrNot[i] = true; } } preferredCar = PlayerPrefs.GetInt("PreferredCar"); chosenCar = SCR_Pool.GetFreeObject(cars[preferredCar]); currentCar = chosenCar; chosenCar.GetComponent <SpawnScript>().Spawn(transform.position, transform.rotation); }
// Start game private void Start() { gameState = GameState.TALKING; player = Instantiate(PFB_Player); boss = Instantiate(PFB_Boss[SCR_Profile.bossSelecting]); security = Instantiate(PFB_Security[SCR_Profile.bossSelecting]); pnlResult.SetActive(false); btnReplay.SetActive(false); btnMainMenu.SetActive(false); imgNotice.SetActive(false); txtTutorial.SetActive(false); imgDanger.gameObject.SetActive(false); SCR_Pool.Flush(); TriggerTutorial(TutorialStep.GRAB); SCR_LightBar.deltaCamera = 0; SCR_UnityAnalytics.StartGame(); internalMoney = SCR_Profile.money; txtMoney.GetComponent <Text>().text = internalMoney.ToString(); txtMoneyAddOriginalPosition = txtMoneyAdd.GetComponent <RectTransform>().anchoredPosition; txtMoneyAddOriginalAnchorMin = txtMoneyAdd.GetComponent <RectTransform>().anchorMin; txtMoneyAddOriginalAnchorMax = txtMoneyAdd.GetComponent <RectTransform>().anchorMax; txtMoneyAddOriginalAlignment = txtMoneyAdd.GetComponent <Text>().alignment; txtMoneyAddOriginalFontSize = txtMoneyAdd.GetComponent <Text>().fontSize; totalReward = 0; objectSpawnTime = Random.Range(OBJECT_SPAWN_TIME_MIN, OBJECT_SPAWN_TIME_MAX); dangerShowed = false; dangerCounter = 0; powerUpSpawnTime = Random.Range(POWER_UP_SPAWN_TIME_MIN, POWER_UP_SPAWN_TIME_MAX); shouldSelect = 0; securityProgress = 0; imgSecurityProgressFG.fillAmount = 0; imgSecurityProgressBG.gameObject.SetActive(false); imgSecurityProgressFG.gameObject.SetActive(false); firstPizza = true; firstDrone = true; }
// ============================================================= // ============================================================= private void Awake() { // Must go through loading first //if (SCR_Loading.loaded == false) { // SceneManager.LoadScene("GSLoading/SCN_Loading"); // return; //} // Singleton instance = this; // Calculate screen resolution SCREEN_RATIO = Screen.width * 1.0f / Screen.height; SCREEN_H = 10.8f; SCREEN_W = 10.8f * SCREEN_RATIO; SCREEN_SCALE = Screen.width / SCREEN_W; // Set camera Camera.main.orthographicSize = SCREEN_H * 0.5f; //Camera.main.transform.position = new Vector3 (SCREEN_W * 0.5f, SCREEN_H * 0.5f, -10); SCR_Pool.Flush(); }