예제 #1
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)
            });
        }
예제 #2
0
        public PlayerInteractiveObject(IInteractiveGameObject interactiveGameObject, PlayerInteractiveObjectDefinition PlayerInteractiveObjectDefinition)
        {
            this.PlayerInteractiveObjectDefinition = PlayerInteractiveObjectDefinition;
            base.BaseInit(interactiveGameObject, false);
            interactiveGameObject.GenerateVisibilityProbes(PlayerInteractiveObjectDefinition.VisibilityProbeDefinition, interactiveGameObject.GetLogicColliderAsBox());
            Debug.Log(interactiveGameObject.VisibilityProbe.LocalPoints.Length);
            this.InteractiveObjectActionPlayerSystem = new InteractiveObjectActionPlayerSystem(this);
            this.WeaponHandlingSystem = new WeaponHandlingSystem(
                this,
                new WeaponHandlingSystemInitializationData(this, PlayerInteractiveObjectDefinition.WeaponHandlingSystemDefinition.WeaponHandlingFirePointOriginLocalDefinition, PlayerInteractiveObjectDefinition.WeaponHandlingSystemDefinition.WeaponDefinition));
            this.FiringTargetPositionSystem = new FiringTargetPositionSystem(PlayerInteractiveObjectDefinition.FiringTargetPositionSystemDefinition);
            this.HealthSystem = new HealthSystem(this, PlayerInteractiveObjectDefinition.HealthSystemDefinition, OnHealthValueChangedAction: this.OnHealthValueChanged);
            this.StunningDamageDealerReceiverSystem = new StunningDamageDealerReceiverSystem(PlayerInteractiveObjectDefinition.StunningDamageDealerReceiverSystemDefinition, this.HealthSystem);
            this.lowHealthPlayerSystem    = new LowHealthPlayerSystem(this.HealthSystem, PlayerInteractiveObjectDefinition.LowHealthPlayerSystemDefinition);
            this.PlayerVisualEffectSystem = new PlayerVisualEffectSystem(this, PlayerInteractiveObjectDefinition.PlayerVisualEffectSystemDefinition);

            this.SkillSystem = new SkillSystem(this, this.InteractiveObjectActionPlayerSystem);
            this.SkillSystem.SetPlayerActionToMainWeaponSkill(this.WeaponHandlingSystem.GetCurrentWeaponProjectileFireActionDefinition());
            this.SkillSystem.SetPlayerActionToSubSkill(PlayerInteractiveObjectDefinition.DeflectingProjectileInteractiveObjectActionInherentData, 0);
            this.SkillSystem.SetPlayerActionToSubSkill(PlayerInteractiveObjectDefinition.PlayerDashTeleportationActionDefinition, 1);

            this.PlayerObjectInteractiveObjectActionStateManager =
                new PlayerObjectInteractiveObjectActionStateManager(this.GameInputManager, this.InteractiveObjectActionPlayerSystem,
                                                                    this.SkillSystem,
                                                                    PlayerInteractiveObjectDefinition.firingInteractiveObjectActionInherentData, PlayerInteractiveObjectDefinition.projectileDeflectionTrackingInteractiveObjectActionInherentData,
                                                                    PlayerInteractiveObjectDefinition.PlayerDashActionStateBehaviorInputDataSystemDefinition,
                                                                    new PlayerObjectInteractiveObjectActionStateManagerCallbacks(
                                                                        onPlayerDashDirectionActionStarted: this.OnPlayerDashDirectionActionStarted,
                                                                        onPlayerDashDirectionActionEnded: this.OnPlayerDashDirectionActionEnded
                                                                        ));

            /// To display the associated HealthSystem value to UI.
            HealthUIManager.Get().InitEvents(this.HealthSystem);

            this.FiringPartialDefinitionInitialize();

            this.lowHealthPlayerSystem.RegisterPlayerLowHealthStartedEvent(this.OnLowHealthStarted);
            this.lowHealthPlayerSystem.RegisterPlayerLowHealthEndedEvent(this.OnLowHealthEnded);

            PlayerInteractiveObjectCreatedEvent.Get().OnPlayerInteractiveObjectCreated(this);
        }