Beispiel #1
0
        public override void Init()
        {
            this.InteractiveGameObject.CreateLogicCollider(InteractiveObjectLogicCollider);
            interactiveObjectTag = new InteractiveObjectTag {
                IsPlayer = true
            };

            PlayerInteractiveObjectInitializerData = PlayerConfigurationGameObject.Get().PlayerGlobalConfiguration.PlayerInteractiveObjectInitializerData;

            #region External Dependencies

            var gameInputManager = GameInputManager.Get();

            #endregion


            var cameraPivotPoint = GameObject.FindGameObjectWithTag(TagConstants.CAMERA_PIVOT_POINT_TAG);

            PlayerInputMoveManager       = new PlayerInputMoveManager(PlayerInteractiveObjectInitializerData.SpeedMultiplicationFactor, cameraPivotPoint.transform, gameInputManager, this.InteractiveGameObject.PhysicsRigidbody);
            PlayerBodyPhysicsEnvironment = new PlayerBodyPhysicsEnvironment(this.InteractiveGameObject.PhysicsRigidbody, this.InteractiveGameObject.PhysicsCollider, PlayerInteractiveObjectInitializerData.MinimumDistanceToStick);
            PlayerSelectionWheelManager  = new PlayerSelectionWheelManager(this, gameInputManager,
                                                                           PlayerActionEntryPoint.Get());

            //Getting persisted position
            PlayerPositionPersistenceManager.Get().Init(this);
            this.InteractiveGameObject.InteractiveGameObjectParent.transform.position = PlayerPositionPersistenceManager.Get().PlayerPositionBeforeLevelLoad.GetPosition();
            this.InteractiveGameObject.InteractiveGameObjectParent.transform.rotation = PlayerPositionPersistenceManager.Get().PlayerPositionBeforeLevelLoad.GetQuaternion();

            this._baseObjectAnimatorPlayableSystem = new BaseObjectAnimatorPlayableSystem(this.AnimatorPlayable, LocomotionAnimationDefinition);
        }
Beispiel #2
0
        protected void OnAwake(LevelType levelType)
        {
            new GameLogHandler();

            this.levelType = levelType;
            this._simulatePhysicsTimeSteps = new SimulatePhysicsTimeSteps(this.ManuallyUpdatePhysicsWorld);

            PersistanceManager.Get().Init();
            StartLevelManager.Get().Init();
            if (levelType == LevelType.STARTMENU)
            {
                GameInputManager.Get().Init(CursorLockMode.Confined);
                Cursor.visible = true;
            }
            else
            {
                GameInputManager.Get().Init(CursorLockMode.Locked);
                Cursor.visible = false;
            }

            LevelAvailabilityManager.Get().Init();
            LevelAvailabilityTimelineManager.Get().Init();
            LevelManager.Get().Init(levelType);

            if (this.levelType != LevelType.STARTMENU)
            {
                LevelChunkFXTransitionManager.Get().Init();
                CoreGameSingletonInstances.Coroutiner.StartCoroutine(InitializeTimelinesAtEndOfFrame());
            }
        }
Beispiel #3
0
        protected void OnAwake(LevelType levelType)
        {
            new GameLogHandler();

            this.levelType = levelType;

            PersistanceManager.Get().Init();
            StartLevelManager.Get().Init();
            if (levelType == LevelType.STARTMENU)
            {
                GameInputManager.Get().Init(CursorLockMode.Confined);
            }
            else
            {
                GameInputManager.Get().Init(CursorLockMode.Locked);
            }

            LevelAvailabilityManager.Get().Init();
            LevelAvailabilityTimelineManager.Get().Init();
            LevelManager.Get().Init(levelType);

            if (this.levelType != LevelType.STARTMENU)
            {
                LevelChunkFXTransitionManager.Get().Init();
                CoreGameSingletonInstances.Coroutiner.StartCoroutine(InitializeTimelinesAtEndOfFrame());
            }
        }
Beispiel #4
0
        /// <summary>
        /// /!\ This method must be called before EVERYTHING else in the LateTick update.
        /// </summary>
        protected void BeforeLateTickGameLogic(out float d, out float unscaled)
        {
            GameInputManager.Get().LateTick();
            TimeManagementManager.Get().LateTick();

            d        = TimeManagementManager.Get().GetCurrentDeltaTime();
            unscaled = TimeManagementManager.Get().GetCurrentDeltaTimeUnscaled();
        }
Beispiel #5
0
        public void Init()
        {
            var playerPosition   = GameObject.FindGameObjectWithTag(TagConstants.PLAYER_TAG).transform;
            var cameraPivotPoint = GameObject.FindGameObjectWithTag(TagConstants.CAMERA_PIVOT_POINT_TAG).transform;

            this.CameraFollowManager      = new CameraFollowManager(playerPosition, cameraPivotPoint, CameraConfigurationGameObject.Get().CameraMovementConfiguration.CameraFollowManagerComponent);
            this.CameraOrientationManager = new CameraOrientationManager(cameraPivotPoint, GameInputManager.Get(), InputConfigurationGameObject.Get().CoreInputConfiguration);
            this.CameraZoomManager        = new CameraZoomManager(Camera.main, GameInputManager.Get());
        }
Beispiel #6
0
        /// <summary>
        /// /!\ This method must be called before EVERYTHING else in the Tick update.
        /// </summary>
        protected void BeforeTickGameLogic(out float d, out float unscaled)
        {
            GameInputManager.Get().Tick();
            PersistanceManager.Get().Tick();

            TimeManagementManager.Get().Tick();

            d        = TimeManagementManager.Get().GetCurrentDeltaTime();
            unscaled = TimeManagementManager.Get().GetCurrentDeltaTimeUnscaled();

            if (levelType != LevelType.STARTMENU)
            {
                LevelChunkFXTransitionManager.Get().Tick(d);
            }
        }
Beispiel #7
0
        /// <summary>
        /// /!\ This method must be called before EVERYTHING else in the FixedTick update.
        /// </summary>
        protected void BeforeFixedTickGameLogic(out float d, out float unscaled)
        {
            GameInputManager.Get().FixedTick();
            TimeManagementManager.Get().FixedTick();

            /// When the time is frozen, we set the Physics to autosimulation.
            /// The reason is that even if time is stopped (Time.deltaTime == 0f), some physics object may be created.
            /// If Physics.autoSimulation is set to false then no Physics occurs when Time.deltaTime == 0f. So we force it to calculate Physics events event if the time is frozen.
            if (Physics.autoSimulation && TimeManagementManager.Get().IsTimeFrozen())
            {
                this._simulatePhysicsTimeSteps.Reset();
            }
            Physics.autoSimulation = !TimeManagementManager.Get().IsTimeFrozen();

            d        = TimeManagementManager.Get().GetCurrentFixedDeltaTime();
            unscaled = TimeManagementManager.Get().GetCurrentDeltaTimeUnscaled();
        }
Beispiel #8
0
        public FiringLockSelectionSystem(Action <CoreInteractiveObject> OnNewInteractiveObjectTargettedCallback)
        {
            this.GameInputManager = GameInputManager.Get();
            this.AllSelectableTargettedInteractiveObject = new List <CoreInteractiveObject>();
            this.OnNewInteractiveObjectTargettedCallback = OnNewInteractiveObjectTargettedCallback;
            this.CurrentlyTargettedInteractiveObject     = default;

            this.CurrentlyTargettedInteractiveObject = new ObjectVariable <CoreInteractiveObject>(
                OnObjectValueChanged: this.OnCurrentlytargettedObjectChanged
                );
            this.InitializeEvents();

            /// Initialization
            foreach (var cursorIntersectedInteractiveObject in InteractiveObjectCursorScreenIntersectionManager.Get().IntersectingInteractiveObjects)
            {
                this.OnCursorOverObject(cursorIntersectedInteractiveObject);
            }
        }
Beispiel #9
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
        }
Beispiel #10
0
        public CameraMovementJobManager()
        {
            this.MainCamera = Camera.main;
            this.CameraPivotPointTransform = new TransformAccessArray(new Transform[] { GameObject.FindGameObjectWithTag(TagConstants.CAMERA_PIVOT_POINT_TAG).transform });

            this.CameraMovementJob = new CameraMovementJob(new NativeArray <CameraMovementJobState>(1, Allocator.Persistent));

            this._cameraOrientationSystem     = new CameraOrientationSystem(GameInputManager.Get());
            this.CameraPanningSystem          = new CameraPanningSystem(CameraConfigurationGameObject.Get().CameraMovementConfiguration);
            this.CameraVerticalRotationSystem = new CameraVerticalRotationSystem(CameraConfigurationGameObject.Get().CameraMovementConfiguration);
            this._cameraZoomSystem            = new CameraZoomSystem(this.MainCamera, GameInputManager.Get());

            /// InitState state
            var CameraMovementJobStateStruct = this.CameraMovementJob.GetCameraMovementJobState();

            CameraMovementJobStateStruct.CameraObject.Initialize(this.CameraPivotPointTransform[0], this.MainCamera);
            this._cameraZoomSystem.InitState(ref CameraMovementJobStateStruct);
            this.CameraVerticalRotationSystem.InitState(ref CameraMovementJobStateStruct);

            this.CameraMovementJob.SetCameraMovementJobState(CameraMovementJobStateStruct);
        }
Beispiel #11
0
        public override void Init()
        {
            this.InteractiveGameObject.CreateLogicCollider(this.PlayerInteractiveObjectDefinition.InteractiveObjectLogicCollider);

            /// Agent creation is used to allow player movement without input.
            this.InteractiveGameObject.CreateAgent(this.PlayerInteractiveObjectDefinition.AIAgentDefinition);
            /// It is disabled by default.
            this.InteractiveGameObject.Agent.enabled = false;

            interactiveObjectTag = new InteractiveObjectTag {
                IsPlayer = true, IsTakingDamage = true
            };

            PlayerInteractiveObjectInitializerData = PlayerConfigurationGameObject.Get().PlayerGlobalConfiguration.PlayerInteractiveObjectInitializerData;

            #region External Dependencies

            this.GameInputManager = GameInputManager.Get();

            #endregion

            this.PlayerSpeedAttenuationSystem = new PlayerSpeedAttenuationSystem();
            this.ObjectMovementSpeedSystem    = new ObjectMovementSpeedSystem(this, PlayerInteractiveObjectInitializerData.TransformMoveManagerComponent, this.PlayerSpeedAttenuationSystem,
                                                                              ObjectSpeedCalculationType.MANUAL);

            var cameraPivotPoint = GameObject.FindGameObjectWithTag(TagConstants.CAMERA_PIVOT_POINT_TAG);
            this.playerMoveManager = new PlayerMoveManager(this, this.ObjectMovementSpeedSystem,
                                                           new PlayerRigidBodyMoveManager(this, PlayerInteractiveObjectInitializerData.TransformMoveManagerComponent, this.ObjectMovementSpeedSystem, cameraPivotPoint.transform),
                                                           new PlayerAgentMoveManager(this, PlayerInteractiveObjectInitializerData.TransformMoveManagerComponent, this.OnDestinationReached));

            PlayerBodyPhysicsEnvironment = new PlayerBodyPhysicsEnvironment(this.InteractiveGameObject.PhysicsRigidbody, this.InteractiveGameObject.PhysicsCollider, PlayerInteractiveObjectInitializerData.MinimumDistanceToStick);

            //Getting persisted position
            PlayerPositionPersistenceManager.Get().Init(this);
            this.InteractiveGameObject.InteractiveGameObjectParent.transform.position = PlayerPositionPersistenceManager.Get().PlayerPositionBeforeLevelLoad.GetPosition();
            this.InteractiveGameObject.InteractiveGameObjectParent.transform.rotation = PlayerPositionPersistenceManager.Get().PlayerPositionBeforeLevelLoad.GetQuaternion();

            this.PlayerObjectAnimationStateManager = new PlayerObjectAnimationStateManager(this.AnimationController, this.PlayerInteractiveObjectDefinition.BaseLocomotionAnimationDefinition);
        }
Beispiel #12
0
        public PlayerAimingInteractiveObjectAction(ref FiringInteractiveObjectActionInput firingInteractiveObjectActionInput) :
            base(firingInteractiveObjectActionInput.PlayerAimingInteractiveObjectActionInherentData.coreInteractiveObjectActionDefinition)
        {
            this.FiringInteractiveObject = firingInteractiveObjectActionInput.firingInteractiveObject;

            var gameInputManager = GameInputManager.Get();

            this._playerAimingInteractiveObjectActionInherentData = firingInteractiveObjectActionInput.PlayerAimingInteractiveObjectActionInherentData;

            this.FiringPlayerActionTargetSystem           = new FiringPlayerActionTargetSystem(this._playerAimingInteractiveObjectActionInherentData, this.FiringInteractiveObject, TargetCursorManager.Get());
            this.PlayerObjectOrientationSystem            = new PlayerObjectOrientationSystem(this.FiringInteractiveObject as IPlayerInteractiveObject, this.FiringPlayerActionTargetSystem);
            this.InteractiveObjectTargettedVisualFeedback = new InteractiveObjectTargettedVisualFeedback(firingInteractiveObjectActionInput.PlayerAimingInteractiveObjectActionInherentData, Camera.main);

            this.ExitActionSystem = new ExitActionSystem(gameInputManager);

            this._firingLockSelectionSystem = new FiringLockSelectionSystem(this.OnInteractiveObjectTargetted);


            /// Initialisation of states
            this.Tick(0f);
            this.AfterTicks(0f);
        }
Beispiel #13
0
        public void AwakeWheel(List <SelectionWheelNodeData> wheelNodeDatas, Transform followingWorldTransform)
        {
            if (!IsWheelEnabled)
            {
                IsWheelEnabled = true;
                this.followingWorldTransform = followingWorldTransform;

                var SelectionWheelGlobalConfiguration = SelectionWheelGlobalConfigurationGameObject.Get().SelectionWheelGlobalConfiguration;

                if (SelectionWheelGameObject == null)
                {
                    SelectionWheelGameObject      = new SelectionWheelGameObject(CoreGameSingletonInstances.GameCanvas);
                    SelectionWheelObjectAnimation = new SelectionWheelObjectAnimation(SelectionWheelGameObject, SelectionWheelGlobalConfiguration.SelectionWheelEnterAnimation, OnExitAnimationFinished);
                }

                SelectionWheelPositionManager = new SelectionWheelPositionManager(this, SelectionWheelGlobalConfiguration, this.followingWorldTransform);
                SelectionWheelObjectAnimation.PlayEnterAnimation();
                ActionWheelActiveNodeManager   = new ActionWheelActiveNodeManager(SelectionWheelGlobalConfiguration.NonSelectedMaterial, SelectionWheelGlobalConfiguration.SelectedMaterial);
                ActionWheelNodePositionManager = new ActionWheelNodePositionManager(SelectionWheelGlobalConfiguration.ActionWheelNodePositionManagerComponent, GameInputManager.Get(), ActionWheelActiveNodeManager);
                wheelNodes = new SelectionWheelNode[wheelNodeDatas.Count];
                for (var i = 0; i < wheelNodeDatas.Count; i++)
                {
                    var wheelNode = SelectionWheelNode.Instantiate(wheelNodeDatas[i]);
                    wheelNode.transform.SetParent(SelectionWheelGameObject.SelectionWheelNodeContainerGameObject.transform, false);
                    wheelNodes[i] = wheelNode;
                }

                ActionWheelNodePositionManager.InitNodes(wheelNodes);
                ActionWheelActiveNodeManager.SelectedNodeChanged(wheelNodes);
            }
        }