Ejemplo n.º 1
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);
        }
Ejemplo n.º 2
0
 void Attack()
 {
     HealthUIManager.SignalDamage(strength);
 }
Ejemplo n.º 3
0
 void Awake()
 {
     instance = this;
 }
Ejemplo n.º 4
0
    /*
     * When we enter a collision box of another object we should check what object it is
     * so we may grab the "IndividualHealth" component of that other object.
     */
    private void OnTriggerEnter(Collider other)
    {
        // Debug.Log("This: " + this.name + " enters " + other.name);

        // "this" is giver of damage, "other" is receiver.
        // 4 types, 16 combinations, see excel table for visualization.
        if (other.tag != this.tag)
        {
            if (other.tag == "Player")
            {
                otherHealth = other.GetComponent <IndividualHealth>();
                otherUI     = other.GetComponent <HealthUIManager>();
                damageOther();
            }

            else if (other.tag == "Obstacle")
            {
                if (this.tag != "Enemy")
                {
                    otherHealth = other.GetComponent <IndividualHealth>();
                    otherUI     = other.GetComponent <HealthUIManager>();
                    damageOther();
                }
            }

            else if (other.tag == "Enemy")
            {
                if (this.tag == "Player")
                {
                    otherHealth = other.GetComponent <IndividualHealth>();
                    otherUI     = other.GetComponent <HealthUIManager>();
                    damageOther();
                }
            }

            else if (other.tag == "EnemyProjectile")
            {
                if (this.tag == "Obstacle")
                {
                    otherHealth = other.GetComponent <IndividualHealth>();
                    otherUI     = other.GetComponent <HealthUIManager>();
                    damageOther();
                }
            }

            else if (other.tag == "Boundary")
            {
            }

            else
            {
                Debug.Log("Damage system encountered something unexpected.");
            }

            // is there a way to make this shorter?
            // i can't stick it in damageOther because it doesn't know what "other" is.

            //otherHealth = other.GetComponent<IndividualHealth>();
            //otherUI = other.GetComponent<HealthUIManager>();
            //damageOther();
        }
    }
Ejemplo n.º 5
0
 void Awake()
 {
     instance = this;
     mTrans   = transform;
 }
Ejemplo n.º 6
0
 private void Awake()
 {
     instance = this;
 }