GameVsJam/3d Prototyp/Assets/Scripts/Interaction/CoffeePlace.cs

26 lines
694 B
C#

using UnityEngine;
namespace Interaction
{
public class CoffeePlace : MonoBehaviour
{
[SerializeField]
private BoxCollider _boxCollider;
public bool IsFree()
{
Collider[] colliders = Physics.OverlapBox(_boxCollider.bounds.center, _boxCollider.bounds.extents);
foreach (Collider c in colliders)
{
// Solbald ein Collider eines Rigidbodies im Weg ist sagen wir, dass wir nichts spawnen können
if (!c.isTrigger && c.attachedRigidbody)
{
return false;
}
}
return true;
}
}
}