Beispiel #1
0
 public virtual void OnProxboxCheck(HitProperties hitProperties)
 {
     if (_Debug)
     {
         Debug.Log("[BaseEnemy] OnProxboxCheck triggered.");
     }
 }
 /// <summary>
 /// Receive the hit properties from the external hitbox
 /// </summary>
 /// <param name="hitProperties"> The hit properties provided by the external hitbox</param>
 public virtual void TakeHitProperties(HitProperties hitProperties)
 {
     if (_Debug)
     {
         Debug.Log("[" + gameObject.name + "/Base] TakeHitProperties triggered.");
     }
 }
Beispiel #3
0
        void Start()
        {
            // Setup the overlap contact settings
            overlapContactFilter.layerMask    = targetLayers;
            overlapContactFilter.useTriggers  = true;
            overlapContactFilter.useLayerMask = true;
            //overlapContacts = new Collider2D[concurrentHitsAllowed];

            // Match the HitProperties state to this hitbox
            if (!activeProperties)
            {
                activeProperties             = ScriptableObject.CreateInstance <HitProperties>();
                activeProperties.HitboxState = hitboxState;
            }
        }
        /// <summary>
        /// Set the hit properties of the active/hurt hitboxes
        /// </summary>
        /// <param name="hitProperties"> The hit properties provided in the animation event</param>
        public virtual void SetHitProperties(HitProperties hitProperties)
        {
            if (_Debug)
            {
                Debug.Log("[" + gameObject.name + "/Base] SetHitProperties triggered.");
            }

            if (!hitProperties)
            {
                Debug.LogError("[AnimationManager] ERROR -> No hit properties provided to SetHitProperties. Did you forget to add the object to the animation event?");
                return;
            }

            // Set the active properties of all the active hitboxes
            activeboxes.activeProperties = hitProperties;
        }
Beispiel #5
0
        public override void TakeHitProperties(HitProperties hitProperties)
        {
            base.TakeHitProperties(hitProperties);

            if (_Debug)
            {
                Debug.Log("[EnemyAnimationManager] Reached TakeHitProperties, attempting to recieve hit properties");
            }

            switch (hitProperties.HitboxState)
            {
            case HitboxStates.Active:
                if (_Debug)
                {
                    Debug.Log("[EnemyAnimationManager] HitProperties received from an activebox. We were hit by something!");
                }

                if (hurtAnimationTrigger != "")
                {
                    SetAnimationTrigger(hurtAnimationTrigger);
                }
                else
                {
                    Debug.LogError("[EnemyAnimationManager] ERROR -> No Hurt Animation trigger found! Please enter the name of the animation trigger in the Inspector!");
                }

                // Apply the damage of the hit properties
                if (hitProperties.HitDamage != 0)
                {
                    baseEnemy.ChangeHealth(-hitProperties.HitDamage);
                }

                // Apply the hit stun of the hit properties
                // This will apply to this script, and change the length of the WarriorHurt

                // Apply the proration of the hit properties
                // The damage multiplier, this may not be a thing yet

                // Apply the velocity of the hit properties
                if (hitProperties.HitVelocity != Vector2.zero)
                {
                    baseEnemy.SetVelocity(hitProperties.HitVelocity, false);
                }


                break;

            case HitboxStates.Hurtbox:
                if (_Debug)
                {
                    Debug.Log("[EnemyAnimationManager] HitProperties received from a hurtbox. We hit something else!");
                }

                // Turn off hitboxes (they will reenable as part of the animation track)
                //  turn this back on
                //activeboxes.SetHitboxActive(false);
                resetActiveHitboxes = true;


                //foreach (Hitbox hitbox in activeboxes) {
                //    hitbox.SetHitboxActive(false);
                //}


                // Set isRecovering off
                baseEnemy.SetRecovering(false);


                break;

            case HitboxStates.Proximity:
                if (_Debug)
                {
                    Debug.Log("[EnemyAnimationManager] HitProperties received from a proximity. An attack is probably imminent! Ignoring tho...");
                }

                baseEnemy.isInOpponentProximity = true;

                //characterManager.facingEnemy = true;

                break;

            default:
                Debug.LogError("[EnemyAnimationManager] HitProperties received from unknown state!");
                break;
            }
        }