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 Damage(Damageble damageble)
    {
        StartCoroutine(StartDelayTimer());

        var damageInfo = new DamageInfo
        {
            damage     = damage,
            damageType = damageType,
        };

        OnDamagedApplied();
        damageble.ApplyDamage(damageInfo);
    }
Beispiel #3
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);
        }
    }
 IEnumerator move()
 {
     while (true)
     {
         RaycastHit2D[] result = new RaycastHit2D[10];
         if (collider.Cast(Vector2.zero, result) > 0 && result[0].collider.gameObject != caster)
         {
             //Debug.Log("Врезался в " + result[0].collider.gameObject.name);
             Damageble damageble = result[0].collider.gameObject.GetComponent <Damageble>();
             if (damageble != null)
             {
                 damageble.TakeHit(hitData);
             }
             destroyBullet();
         }
         else
         {
             Vector3 additional = gameObject.transform.up * speed;
             gameObject.transform.position += additional;
         }
         yield return(new WaitForEndOfFrame());
     }
 }