private void SetInitialReferences() { gameManagerMaster = GameObject.FindGameObjectWithTag("GameController").GetComponent <GameManager_Master>(); UIPrefabs = GameObject.FindGameObjectWithTag("GameController").GetComponent <UIPrefabInit>(); player = GameObject.FindGameObjectWithTag("Player"); achievReporter = FindObjectOfType <AchievementReporter>(); owned = false; //If we own the skin already disable locked image. for (int i = 0; i < NewSaveGame.Instance.ownedCharacters.Count; i++) { if ((int)Name == NewSaveGame.Instance.ownedCharacters[i]) { LockedImage.gameObject.SetActive(false); owned = true; CostText.text = "Owned"; CostText.color = Color.black; } } if (!owned) { CostText.text = UnlockCost.ToString(); if (NewSaveGame.Instance.pages >= UnlockCost) { CostText.color = Color.black; } else { CostText.color = Color.red; } } prefabSplit = NewSaveGame.Instance.prefabs[NewSaveGame.Instance.usedPrefab].Split(','); int.TryParse(prefabSplit[0], out usedBook); int.TryParse(prefabSplit[1], out usedOther); BookSkinSelect.SelectedBookSkin = usedBook; if ((int)Name == SelectedBookSkin) { gameObject.GetComponent <Image>().color = SelectedColorStatic; } else { gameObject.GetComponent <Image>().color = new Color32(255, 255, 255, 0); } }
void Awake() { GameManager_Master.gameState = GameState.Menu; ProCamera2D.Instance.OffsetX = menuCameraXOffset; gameManagerMaster = GameObject.FindGameObjectWithTag("GameController").GetComponent <GameManager_Master>(); if (gameManagerMaster == null) { Debug.LogError("gameManagerMaster null in Movement - Awake."); } achievReporter = FindObjectOfType <AchievementReporter>(); if (achievReporter == null) { Debug.LogError("achievReporter null in Movement - Awake."); } numberOriginResets = 0; GameManager_Master.canRevive = true; GameManager_Master.canRevivePages = true; startDelayActive = false; lastObjectTouched = null; runSpeedUnModified = runSpeed; runSpeed = initialRunSpeed; currentGravity = gravity; //multiple sources used so I can do instant cutoff of run and glide sound when jump or land etc. AudioSource[] sources = GetComponents <AudioSource>(); _audioSource = sources[0]; _glideAudioSource = sources[1]; _runAudioSource = sources[2]; _animator = GetComponent <Animator>(); _animator.SetFloat("RunMultiplier", 1); _controller = GetComponent <CharacterController2D>(); _controller.onTriggerEnterEvent += onTriggerEnterEvent; _controller.onTriggerExitEvent += onTriggerExitEvent; StartCoroutine(PlayerSpeedBuildUp()); }