コード例 #1
0
    private void Update()
    {
        if (SetPlayerPosition)
        {
            SetPlayerPosition = false;
            PlayerInteractiveObjectManager.Get().PlayerInteractiveObject.SetDestination(new ForwardAgentMovementCalculationStrategy(new AIDestination()
            {
                Rotation = this.TargetPlayerPosition.rotation, WorldPosition = this.TargetPlayerPosition.position
            }));
        }

        if (DestroyAllObstacles)
        {
            DestroyAllObstacles = false;

            for (var i = ObstacleInteractiveObjectManager.Get().AllObstacleInteractiveObjects.Count - 1; i >= 0; i--)
            {
                var currentInteractiveObject = ObstacleInteractiveObjectManager.Get().AllObstacleInteractiveObjects[i];
                currentInteractiveObject.Destroy();
            }
        }

        if (RestartLevel)
        {
            LevelTransitionManager.Get().RestartCurrentLevel();
            RestartLevel = false;
        }

        if (RestoreHealth)
        {
            PlayerInteractiveObjectManager.Get().PlayerInteractiveObject.DealDamage(40, null);
            RestoreHealth = false;
        }
    }
コード例 #2
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()); });
            }
        }
コード例 #3
0
        private void Start()
        {
            this.GetComponent <Button>().onClick.AddListener(() =>
            {
                //Destroy all saved data
                var persistanceDirectory = new DirectoryInfo(Application.persistentDataPath);
                foreach (var directory in persistanceDirectory.GetDirectories())
                {
                    directory.Delete(true);
                }

                LevelTransitionManager.Get().OnStartMenuToLevel(StartLevelManager.Get().GetStartLevelID());
            });
        }
コード例 #4
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);
        }