Пример #1
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="Damage"></param>
 private void OnKilledCharacter(FAttackData Damage, EHDamageableComponent DamageComponentWeHit)
 {
     if (DamageComponentWeHit.Health <= 0)
     {
         CharacterAnim.SetTrigger(ANIM_KILL_CANCEL);
     }
 }
Пример #2
0
    /// <summary>
    ///
    /// </summary>
    /// <param name="OurHitbox"></param>
    /// <param name="OtherHurtbox"></param>
    private void OurHitboxIntersectOtherHurtbox(EHHitbox OurHitbox, EHHitbox OtherHurtbox)
    {
        if (OurHitbox == null || OtherHurtbox == null)
        {
            return;
        }

        if (OtherHurtbox.HitboxActorComponent.bAnimationIsInvincible)
        {
            return;//Other character was invincible when we attempted to hit them, may in the future want to add some kind of wiff affect to indicate that you made contact but couldn't hurt them
        }

        EHDamageableComponent OtherDamageableComponent = OtherHurtbox.HitboxActorComponent.DamageableComponent;

        if (OtherDamageableComponent == null)
        {
            Debug.LogWarning("There is no Damageable component associated with the hurtbox we are intersecting");
            return;
        }
        if (AttackComponent == null)
        {
            Debug.LogWarning("There is no Attack component associated with our intersecting Hitbox");
            return;
        }
        AttackComponent.OnDamageableComponentIntersectionBegin(OtherDamageableComponent);
    }
Пример #3
0
    private void Awake()
    {
        DamageComponent = GetComponent <EHDamageableComponent>();
        DamageComponent.OnCharacterHealthChanged += OnCharacterHit;
        CharacterAnimator = GetComponent <Animator>();

        bCanParry = true;
    }
Пример #4
0
    /// <summary>
    /// This method will be called when a hitbox component enters the hurtbox component of another damageable component
    /// </summary>
    public virtual void OnDamageableComponentIntersectionBegin(EHDamageableComponent DamageableComponentWeHit)
    {
        if (IntersectedDamageableComponents.Contains(DamageableComponentWeHit))
        {
            // Skip if we have already hit this component before resetting...
            return;
        }

        if (DamageableComponentWeHit.GetAllignedCharacterTeam() == GetAllignedCharacterTeam())
        {
            return;//Don't hit characters that are on the same team as us
        }

        FAttackData AttackData;

        if (AssociatedAttackTable == null)
        {
            AttackData = DefaultAttackData;
        }
        else if (BaseGameOverseer.Instance.DataTableManager.GetAttackDataFromAttackDataTable(AssociatedAttackTable, AssociatedAnimator.GetCurrentAnimatorStateInfo(0).shortNameHash, out AttackData))
        {
        }
        else
        {
            Debug.LogWarning("This animation has not be set up in our attack Data table: " + AssociatedAnimator.GetCurrentAnimatorStateInfo(0).shortNameHash.ToString());
            AttackData = DefaultAttackData;
        }
        IntersectedDamageableComponents.Add(DamageableComponentWeHit);
        if (!DamageableComponentWeHit.TakeDamage(this, AttackData.AttackDamage))
        {
            return;//If we were not able to successfully hurt the other character we will skip all other effects
        }

        if (BaseGameOverseer.Instance.MainGameCamera && BaseGameOverseer.Instance.MainGameCamera.CameraShake)
        {
            BaseGameOverseer.Instance.MainGameCamera.CameraShake.BeginCameraShake(AttackData.CameraShakeDuration, AttackData.CameraShakeIntensity);
            BaseGameOverseer.Instance.GlobalEffectManager.StartFreezeTimeForSeconds(AttackData.HitFreezeTime);
        }

        float ScaleX = Mathf.Sign(DamageableComponentWeHit.transform.position.x - transform.position.x);

        if (ScaleX == 0)
        {
            ScaleX = 1;
        }
        DamageableComponentWeHit.ApplyKnockback(AttackData.HitStunTime, new Vector2(ScaleX, 1) * AttackData.LaunchForce);
        if (AttackData.bIsConstantHitbox)
        {
            StartCoroutine(ClearHitListNextFrame());
        }

        OnAttackCharacterDel?.Invoke(AttackData, DamageableComponentWeHit);
    }
Пример #5
0
 private void Awake()
 {
     MovementComponent = GetComponent <EHCharacterMovementComponent>();
     DamageComponent   = GetComponent <EHDamageableComponent>();
     Physics2D         = GetComponent <EHPhysics2D>();
     CharacterAnim     = GetComponent <Animator>();
     MovementComponent.OnCharacterLanded += OnCharacterLanded;
     DashesRemaining = MaxDashesBeforeLanding;
     if (DamageComponent)
     {
         DamageComponent.OnCharacterHealthChanged += OnCharacterHealthChanged;
     }
 }
Пример #6
0
 private void OnCharacterHit(FAttackData AttackData, EHDamageableComponent DamageableComponent)
 {
     Destroy(this.gameObject);
 }
Пример #7
0
    /// <summary>
    /// Coroutine that will pause time when an attack is made. This is to give a more satisfying feel to the hit ideally
    /// </summary>
    /// <param name="SecondsToPauseGameWhenHitConnected"></param>
    /// <returns></returns>
    private IEnumerator StopTimeWhenHitCoroutine(float SecondsToPauseGameWhenHitConnected, EHDamageableComponent DamageComponentThatWeHit, FAttackData AttackData)
    {
        float TimeThatHasPassed = 0;



        while (TimeThatHasPassed < SecondsToPauseGameWhenHitConnected)
        {
            TimeThatHasPassed += EHTime.RealDeltaTime;
            yield return(null);
        }
    }
Пример #8
0
 public virtual void OnDamageableComponentIntersectionEnd(EHDamageableComponent DamageableComponentHit)
 {
 }