Пример #1
0
        public override void OnDestroy()
        {
            base.OnDestroy();
            if (this.CameraPivotPointTransform.isCreated)
            {
                this.CameraPivotPointTransform.Dispose();
            }

            this.CameraMovementJob.Dispose();

            PlayerInteractiveObjectCreatedEvent.Get().UnRegisterPlayerInteractiveObjectCreatedEvent(this.OnPlayerInteractiveObjectCreated);
            PlayerInteractiveObjectDestroyedEvent.Get().UnRegisterPlayerInteractiveObjectDestroyedEvent(this.OnPlayerInteractiveObjectDestroyed);
        }
Пример #2
0
        protected override void Start()
        {
            base.OnStart();

            /// Preventing switching to the "Game" window in editor.
            UnityEditor.SceneView.FocusWindowIfItsOpen(typeof(UnityEditor.SceneView));

            base.Start();

            PlayerInteractiveObjectCreatedEvent.Get().RegisterPlayerInteractiveObjectCreatedEvent((p) =>
            {
                /// Player is forced to be controlled by agent
                PlayerInteractiveObjectManager.Get().PlayerInteractiveObject.PlayerMoveManager.ForceSwitchToAgent();
            });
        }
Пример #3
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);
        }
Пример #4
0
 public void InitializeEvents()
 {
     PlayerInteractiveObjectCreatedEvent.Get().RegisterPlayerInteractiveObjectCreatedEvent(this.OnPlayerInteractiveObjectCreated);
     PlayerInteractiveObjectDestroyedEvent.Get().RegisterPlayerInteractiveObjectDestroyedEvent(this.OnPlayerInteractiveObjectDestroyed);
 }