Grass Cutters Together: the project as of moon-sweepers f3666f0
A clean start for the shared repository: the Unity project (Assets, Packages, ProjectSettings), ArtSource, Docs and Tools as they stood at f3666f0 in the old local repository, with its generated prefabs and scene brought up to date. Images, audio, models and binaries go through Git LFS (.gitattributes). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
25
Assets/Scripts/World/GridBlocker.cs
Normal file
25
Assets/Scripts/World/GridBlocker.cs
Normal file
@ -0,0 +1,25 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace GrassCutter
|
||||
{
|
||||
/// <summary>
|
||||
/// 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 <see cref="center"/>.
|
||||
/// </summary>
|
||||
public class GridBlocker : MonoBehaviour
|
||||
{
|
||||
public Vector3 center;
|
||||
public Vector2 size = Vector2.one;
|
||||
|
||||
public static readonly System.Collections.Generic.List<GridBlocker> All = new System.Collections.Generic.List<GridBlocker>();
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user