using UnityEngine;
namespace GrassCutter
{
///
/// Fixed rig buildings (terminal, crew cabin, harbour) keep the ground under them to themselves, so nothing can be
/// built into them. Footprint = a local rectangle around .
///
public class GridBlocker : MonoBehaviour
{
public Vector3 center;
public Vector2 size = Vector2.one;
public static readonly System.Collections.Generic.List All = new System.Collections.Generic.List();
void OnEnable() => All.Add(this);
void OnDisable() => All.Remove(this);
public bool Covers(Vector3 p)
{
var d = p - transform.TransformPoint(center);
return Mathf.Abs(Vector3.Dot(d, transform.right)) < size.x * 0.5f && Mathf.Abs(Vector3.Dot(d, transform.forward)) < size.y * 0.5f;
}
}
}