示例#1
0
 public PlayerMoveManager(PlayerInteractiveObject playerAimingInteractiveObjectRef, ObjectMovementSpeedSystem PlayerObjectMovementSpeedSystemRef,
                          PlayerRigidBodyMoveManager PlayerRigidBodyMoveManager, PlayerAgentMoveManager PlayerAgentMoveManager)
 {
     this._playerIeractiveObjectRef          = playerAimingInteractiveObjectRef;
     this.PlayerObjectMovementSpeedSystemRef = PlayerObjectMovementSpeedSystemRef;
     this.PlayerRigidBodyMoveManager         = PlayerRigidBodyMoveManager;
     this.PlayerAgentMoveManager             = PlayerAgentMoveManager;
     this.PlayerMoveManagerState             = new PlayerMoveManagerState(
         OnFromInputActivated: this.EnableFromInput,
         OnFromAgentActivated: this.EnableFromAgent);
 }
示例#2
0
        public SoliderEnemy(IInteractiveGameObject parent, SoliderEnemyDefinition SoliderEnemyDefinition)
        {
            var mainCamera = Camera.main;

            parent.CreateLogicCollider(SoliderEnemyDefinition.InteractiveObjectBoxLogicColliderDefinition);
            parent.CreateAgent(SoliderEnemyDefinition.AIAgentDefinition);
            this.interactiveObjectTag = new InteractiveObjectTag()
            {
                IsTakingDamage = true
            };
            BaseInit(parent);
            this.InteractiveObjectActionPlayerSystem = new InteractiveObjectActionPlayerSystem(this);
            this.HealthSystem = new HealthSystem(this, SoliderEnemyDefinition.HealthSystemDefinition, this.OnHealthChanged);
            this._stunningDamageDealerReceiverSystem = new StunningDamageDealerReceiverSystem(SoliderEnemyDefinition.stunningDamageDealerReceiverSystemDefinition, this.HealthSystem, this.OnStunningDamageDealingStarted, this.OnStunningDamageDealingEnded);
            this.WeaponHandlingSystem = new WeaponHandlingSystem(this,
                                                                 new WeaponHandlingSystemInitializationData(this, SoliderEnemyDefinition.WeaponHandlingSystemDefinition.WeaponHandlingFirePointOriginLocalDefinition,
                                                                                                            SoliderEnemyDefinition.WeaponHandlingSystemDefinition.WeaponDefinition));
            this.FiringTargetPositionSystem        = new FiringTargetPositionSystem(SoliderEnemyDefinition.FiringTargetPositionSystemDefinition);
            this.ObjectMovementSpeedSystem         = new ObjectMovementSpeedSystem(this, SoliderEnemyDefinition.AITransformMoveManagerComponentV3, new UnConstrainedObjectSpeedAttenuationValueSystem(AIMovementSpeedAttenuationFactor.RUN), ObjectSpeedCalculationType.AGENT);
            this.AIMoveToDestinationSystem         = new AIMoveToDestinationSystem(this, SoliderEnemyDefinition.AITransformMoveManagerComponentV3, this.OnAIDestinationReached);
            this.SoliderEnemyAnimationStateManager = new SoliderEnemyAnimationStateManager(this.AnimationController, SoliderEnemyDefinition.LocomotionAnimation, SoliderEnemyDefinition.SoldierAnimationSystemDefinition);
            this._soldierStateBehavior             = new SoldierStateBehavior();

            this.SightObjectSystem = new SightObjectSystem(this, SoliderEnemyDefinition.SightObjectSystemDefinition, tag => tag.IsPlayer || tag.IsGivingHealth,
                                                           this._soldierStateBehavior.OnInteractiveObjectJustOnSight, null, this._soldierStateBehavior.OnInteractiveObjectJustOutOfSight);

            Profiler.BeginSample("SoliderEnemy : Memory test");
            this.SightVisualFeedbackSystemPtr = SightVisualFeedbackSystemPointer.Allocate();
            this.SightVisualFeedbackSystemPtr.Ref()->Initialize(SoliderEnemyDefinition.SightVisualFeedbackSystemDefinition, this, mainCamera);
            this.SightVisualFeedbackStateBehavior = new SightVisualFeedbackStateBehavior(this.SightVisualFeedbackSystemPtr);
            Profiler.EndSample();

            this._soldierStateBehavior.Init(this, SoliderEnemyDefinition.SoldierAIBehaviorDefinition,
                                            new SoldierAIBehaviorExternalCallbacksV2()
            {
                SetAIAgentDestinationAction          = this.SetDestination,
                SetAIAgentDestinationAction_NoReturn = (IAgentMovementCalculationStrategy => this.SetDestination(IAgentMovementCalculationStrategy)),
                SetAIAgentSpeedAttenuationAction     = this.SetAISpeedAttenuationFactor,
                ClearAIAgentPathAction = this.AIMoveToDestinationSystem.ClearPath,
                AskToFireAFiredprojectile_WithWorldDirection_Action = this.FireProjectileAction_Start,
                GetWeaponFirePointOriginLocalDefinitionAction       = () => SoliderEnemyDefinition.WeaponHandlingSystemDefinition.WeaponHandlingFirePointOriginLocalDefinition,
                OnShootingAtPlayerStartAction = this.OnShootingAtPlayerStart,
                OnShootingAtPlayerEndAction   = this.OnShootingAtPlayerEnd,
                GetIWeaponHandlingSystem_DataRetrievalAction = this.WeaponHandlingSystem,
                OnMoveTowardsPlayerStartedAction             = (CoreInteractiveObject MovingTowardsObject) => this.SightVisualFeedbackStateBehavior.SetSightVisualFeedbackState(SightVisualFeedbackState.DANGER),
                OnMoveTowardsPlayerEndedAction              = () => this.SightVisualFeedbackStateBehavior.SetSightVisualFeedbackState(SightVisualFeedbackState.NONE),
                OnMoveAroundPlayerStartedAction             = (Vector3 LockedWorldPosition) => this.SightVisualFeedbackStateBehavior.SetSightVisualFeedbackState(SightVisualFeedbackState.WARNING),
                OnMoveAroundPlayerEndedAction               = () => this.SightVisualFeedbackStateBehavior.SetSightVisualFeedbackState(SightVisualFeedbackState.NONE),
                OnMoveToLastSeenPlayerPositionStartedAction = (Vector3 LockedWorldPosition) => this.SightVisualFeedbackStateBehavior.SetSightVisualFeedbackState(SightVisualFeedbackState.WARNING),
                OnMoveToLastSeenPlayerPositionEndedAction   = () => this.SightVisualFeedbackStateBehavior.SetSightVisualFeedbackState(SightVisualFeedbackState.NONE)
            });
        }
示例#3
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);
        }