コード例 #1
0
    private void HitSomething(IEnemyHittable hitObject)
    {
        hitObject.Hit(damageOnHit, transform.position);

        if (destroyWhenHit)
        {
            Destroy(gameObject);
        }
    }
コード例 #2
0
    private void CheckCollidersOverlap()
    {
        int collisionsCount = thisCollider.OverlapCollider(contactFilter, overlapingColliders);

        for (int i = 0; i < collisionsCount; i++)
        {
            if (overlapingColliders[i] != null)
            {
                IEnemyHittable enemyHittable = overlapingColliders[i].attachedRigidbody.GetComponent <IEnemyHittable>();
                if (enemyHittable != null)
                {
                    if (HitSomething != null)
                    {
                        HitSomething(enemyHittable);
                    }
                }
            }
        }
    }
コード例 #3
0
 protected virtual void HitSomething(IEnemyHittable objectHit)
 {
     objectHit.Hit(damageOnHit, transform.position);
 }
コード例 #4
0
    protected override void HitSomething(IEnemyHittable objectHit)
    {
        base.HitSomething(objectHit);

        hitSomething = true;
    }