public void Awake() { transform.position = Vector3.zero; gameManager = GameObject.FindWithTag("GameController").GetComponent <GameManager>(); historyManager = gameManager.gameObject.GetComponent <RotationsHistoryManager>(); sectionRotator = new GameObject("SectionRotator").AddComponent <SectionRotator>(); sectionRotator.transform.SetParent(transform); sectionRotator.transform.localPosition = Vector3.zero; currentState = CubeState.Idle; }
private void Awake() { int size = GameSessionManager.Instance.CubeSize; SaveManager.Instance.PreLoadSavedGame(); historyManager = GetComponent <RotationsHistoryManager>(); bool loaded = false; if (!GameSessionManager.Instance.NewGame && SaveManager.Instance.SavedGameExists) { SaveManager.Instance.LoadCurrentSavedGame(out size, out List <List <List <int> > > stickers, out List <RotationAction> history, out timer); cubeManager = GetComponent <CubeBuilder>().LoadCube(size, stickers); historyManager.LoadRotationHistory(history); loaded = true; } else { cubeManager = GetComponent <CubeBuilder>().CreateCube(size); } playerInputManager.SetCubeManager(cubeManager); cameraMovementManager = playerInputManager.gameObject.GetComponent <CameraMovementManager>(); cameraMovementManager.SetUpInitialTargets(size); playerInputManager.gameObject.GetComponent <LevelBGManager>().SetLvlBG(size); hudManager = GameObject.FindWithTag("HUD").GetComponent <HUDManager>(); hudManager.ShowGameHUDAtStart(); SceneFader.Instance.FadeNow(0.25f, true, loaded ? (Action)(() => StartCoroutine(FromLoadedGame())) : (Action)(() => StartCoroutine(ScramblingCube()))); }