Ejemplo n.º 1
0
        public static void Init()
        {
            var startLevelManager            = StartLevelManager.Get();
            var StartMenuPrefabConfiguration = StartMenuSingletonInstances.StartMenuStaticConfigurationManager.StartMenuStaticConfiguration.StartMenuPrefabConfiguration;
            var StartMenuCanvas = CoreGameSingletonInstances.GameCanvas;

            IGameProgressionStateManagerDataRetriever IGameProgressionStateManagerDataRetriever = StartMenuSingletonInstances.GameProgressionStateManager;

            var NewGameButton = MonoBehaviour.Instantiate(StartMenuPrefabConfiguration.StartMenuButtonBasePrefab, StartMenuCanvas.transform);

            NewGameButton.GetComponentInChildren <Text>().text        = "New Game";
            ((RectTransform)NewGameButton.transform).anchoredPosition = new Vector2(0, 40);

            NewGameButton.onClick.AddListener(() =>
            {
                //Destroy all saved data
                var persistanceDirectory = new DirectoryInfo(Application.persistentDataPath);
                foreach (var directory in persistanceDirectory.GetDirectories())
                {
                    directory.Delete(true);
                }

                LevelTransitionManager.Get().OnStartMenuToLevel(LevelManagementConfigurationGameObject.Get().GlobalLevelConfiguration.NewGameStartLevelID);
            });

            var ContinueButton = MonoBehaviour.Instantiate(StartMenuPrefabConfiguration.StartMenuButtonBasePrefab, StartMenuCanvas.transform);

            ContinueButton.GetComponentInChildren <Text>().text        = "Continue";
            ((RectTransform)ContinueButton.transform).anchoredPosition = new Vector2(0, -40);
            ContinueButton.interactable = IGameProgressionStateManagerDataRetriever.HasAlreadyPlayed();
            if (ContinueButton.IsInteractable())
            {
                ContinueButton.onClick.AddListener(() => { LevelTransitionManager.Get().OnStartMenuToLevel(startLevelManager.GetStartLevelID()); });
            }
        }
Ejemplo n.º 2
0
        private void Start()
        {
            OnStart();


            RangeObjectV2Manager.Get().Init();
            GroundEffectsManagerV2.Get().Init(LevelManagementConfigurationGameObject.Get().LevelConfiguration.ConfigurationInherentData[LevelManager.Get().GetCurrentLevel()].LevelRangeEffectInherentData);
            InteractiveObjectV2Manager.Get().Init();

            CameraMovementManager.Get().Init();

            CircleFillBarRendererManager.Get().Init();
            TutorialManager.Get().Init();
            SelectableObjectManagerV2.Get().Init(GameInputManager.Get());

            PlayerActionEntryPoint.Get().Init();
#if UNITY_EDITOR
            EditorOnlyManagers = new EditorOnlyManagers();
            EditorOnlyManagers.Init();
#endif
        }
Ejemplo n.º 3
0
        public void Init()
        {
            /// Events
            ControlsWindowExitedEvent.Get().RegisterControlsWindowExitedEventAction(this.OnControlWindowExited);
            ;
            var StartMenuCanvas = CoreGameSingletonInstances.GameCanvas;
            var StartMenuPrefabConfiguration = StartMenuSingletonInstances.StartMenuStaticConfigurationManager.StartMenuStaticConfiguration.StartMenuPrefabConfiguration;

            this.StartMenuGameObject = new StartMenuGameObject(StartMenuCanvas, StartMenuPrefabConfiguration);

            IGameProgressionStateManagerDataRetriever IGameProgressionStateManagerDataRetriever = StartMenuSingletonInstances.GameProgressionStateManager;

            var Level1Button = this.StartMenuGameObject.CreateStartMenuButton();

            Level1Button.GetComponentInChildren <Text>().text = "Level 1";

            (Level1Button.transform as RectTransform).Reset(RectTransformSetup.CENTER);
            (Level1Button.transform as RectTransform).pivot            = new Vector2(0.5f, 0.5f);
            (Level1Button.transform as RectTransform).localPosition    = Vector3.zero;
            (Level1Button.transform as RectTransform).sizeDelta        = new Vector2(200, 30);
            (Level1Button.transform as RectTransform).anchoredPosition = new Vector2(0, 40);

            Level1Button.onClick.AddListener(() =>
            {
                //Destroy all saved data
                var persistanceDirectory = new DirectoryInfo(Application.persistentDataPath);
                foreach (var directory in persistanceDirectory.GetDirectories())
                {
                    directory.Delete(true);
                }

                LevelTransitionManager.Get().OnStartMenuToLevel(LevelManagementConfigurationGameObject.Get().GlobalLevelConfiguration.NewGameStartLevelID);
            });

            var InfiniteLevelButton = this.StartMenuGameObject.CreateStartMenuButton();

            InfiniteLevelButton.GetComponentInChildren <Text>().text = "Infinite Level";

            (InfiniteLevelButton.transform as RectTransform).Reset(RectTransformSetup.CENTER);
            (InfiniteLevelButton.transform as RectTransform).pivot            = new Vector2(0.5f, 0.5f);
            (InfiniteLevelButton.transform as RectTransform).localPosition    = Vector3.zero;
            (InfiniteLevelButton.transform as RectTransform).sizeDelta        = new Vector2(200, 30);
            (InfiniteLevelButton.transform as RectTransform).anchoredPosition = new Vector2(0, -40);

            InfiniteLevelButton.onClick.AddListener(() =>
            {
                //Destroy all saved data
                var persistanceDirectory = new DirectoryInfo(Application.persistentDataPath);
                foreach (var directory in persistanceDirectory.GetDirectories())
                {
                    directory.Delete(true);
                }

                LevelTransitionManager.Get().OnStartMenuToLevel(LevelZonesID.INFINITE_LEVEL);
            });

            var ControlsButton = this.StartMenuGameObject.CreateStartMenuButton();

            ControlsButton.GetComponentInChildren <Text>().text = "Controls";


            (ControlsButton.transform as RectTransform).Reset(RectTransformSetup.CENTER);
            (ControlsButton.transform as RectTransform).pivot            = new Vector2(0.5f, 0.5f);
            (ControlsButton.transform as RectTransform).localPosition    = Vector3.zero;
            (ControlsButton.transform as RectTransform).sizeDelta        = new Vector2(200, 30);
            (ControlsButton.transform as RectTransform).anchoredPosition = new Vector2(0, -120);

            ControlsButton.onClick.AddListener(this.OnControlsButtonClicked);
        }