Added grid carving
This commit is contained in:
parent
0d5f9f4803
commit
6241d237af
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,31 @@
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public class SlotPathDeleter : MonoBehaviour
|
||||||
|
{
|
||||||
|
[SerializeField] private GridManager TargetCarveGrid;
|
||||||
|
|
||||||
|
private void Start()
|
||||||
|
{
|
||||||
|
Invoke(nameof(LateStart), 0.1f);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LateStart()
|
||||||
|
{
|
||||||
|
MeshCollider[] targets = TargetCarveGrid.SpawnedSlots.Select(x=>x.GetComponentInChildren<MeshCollider>()).ToArray();
|
||||||
|
|
||||||
|
BoxCollider[] colliders = GetComponentsInChildren<BoxCollider>();
|
||||||
|
for (int i = 0; i < colliders.Length; i++)
|
||||||
|
{
|
||||||
|
for (int j = 0; j < targets.Length; j++)
|
||||||
|
{
|
||||||
|
if (colliders[i].bounds.Intersects(targets[j].bounds))
|
||||||
|
{
|
||||||
|
Destroy(targets[j].gameObject);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 37a80941383726449a76228f163f0a26
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
Loading…
Reference in New Issue