Exemplo n.º 1
0
    // Call from attack scripts when active
    public void HitboxUpdate()
    {
        // Disabled, don't collide
        if (m_colliderState == EColliderState.closed)
        {
            return;
        }

        // Get colliders overlapping with ours
        Collider[] colliders = OverlapCollider();

        for (int i = 0; i < colliders.Length; i++)
        {
            Collider hit   = colliders[i];
            int      hitID = hit.GetInstanceID();

            if (!m_objectsHit.Contains(hitID))
            {
                m_hitboxListener?.CollidedWith(hit);
                m_objectsHit.Add(hitID);
            }
        }

        // Update state
        m_colliderState = (colliders.Length > 0) ? EColliderState.colliding : EColliderState.open;
    }
Exemplo n.º 2
0
 public void DisableCollisions()
 {
     m_colliderState = EColliderState.closed;
     m_objectsHit.Clear();
 }
Exemplo n.º 3
0
 public void EnableCollisions()
 {
     m_colliderState = EColliderState.open;
     m_objectsHit.Clear();
 }
Exemplo n.º 4
0
 public void ToggleHitbox()
 {
     m_colliderState = (m_colliderState == EColliderState.open) ? EColliderState.closed : EColliderState.open;
 }