Beispiel #1
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (active)
     {
         Damageble _ = collision.GetComponent <Damageble>();
         if (_ != null)
         {
             _.DoDamage(new DamageInfo(Faction.ToEnemy, DashDamage));
         }
     }
 }
Beispiel #2
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (!active)
        {
            return;
        }
        Damageble damageble = collision.gameObject.GetComponent <Damageble>();

        if (damageble == null)
        {
            return;
        }
        DamageInfo damageInfo = new DamageInfo(Faction.ToEnemy, PlayerBaseClass.current.playerMelee.damage);

        damageble.DoDamage(damageInfo);

        EnemyMovement movement = collision.gameObject.GetComponent <EnemyMovement>();

        if (movement != null)
        {
            movement.DoKnockback(HelperClass.V3toV2(collision.transform.position - PlayerBaseClass.current.transform.position).normalized *PlayerBaseClass.current.playerMelee.strength);
        }
    }