|
|
|
|
|
|
var testGo = new GameObject("test"); |
|
|
|
var position = new Vector3(3.5f, 8f, 17f); |
|
|
|
testGo.transform.position = position; |
|
|
|
var boxOverlap = TestBoxOverlapChecker.CreateChecker(gridSizeX: 10, gridSizeZ: 10, rotateWithAgent: false, rootReference: testGo); |
|
|
|
var boxOverlap = TestBoxOverlapChecker.CreateChecker(gridSizeX: 10, gridSizeZ: 10, rotateWithAgent: false, rootReference: testGo, centerObject: testGo); |
|
|
|
|
|
|
|
Assert.AreEqual(new Vector3(-4.5f, 0, -4.5f) + position, boxOverlap.GetCellGlobalPosition(0)); |
|
|
|
Assert.AreEqual(new Vector3(-4.5f, 0, 4.5f) + position, boxOverlap.GetCellGlobalPosition(9)); |
|
|
|
|
|
|
var testGo = new GameObject("test"); |
|
|
|
var position = new Vector3(15f, 6f, 13f); |
|
|
|
testGo.transform.position = position; |
|
|
|
var boxOverlap = TestBoxOverlapChecker.CreateChecker(gridSizeX: 5, gridSizeZ: 15, rotateWithAgent: true, rootReference: testGo); |
|
|
|
var boxOverlap = TestBoxOverlapChecker.CreateChecker(gridSizeX: 5, gridSizeZ: 15, rotateWithAgent: true, rootReference: testGo, centerObject: testGo); |
|
|
|
|
|
|
|
Assert.AreEqual(new Vector3(-2f, 0, -7f) + position, boxOverlap.GetCellGlobalPosition(0)); |
|
|
|
Assert.AreEqual(new Vector3(-2f, 0, 7f) + position, boxOverlap.GetCellGlobalPosition(14)); |
|
|
|
|
|
|
var testGo = new GameObject("test"); |
|
|
|
testGo.transform.position = Vector3.zero; |
|
|
|
testObjects.Add(testGo); |
|
|
|
var boxOverlap = TestBoxOverlapChecker.CreateChecker(rootReference: testGo, initialColliderBufferSize: 2, maxColliderBufferSize: 5); |
|
|
|
var boxOverlap = TestBoxOverlapChecker.CreateChecker(rootReference: testGo, centerObject: testGo, initialColliderBufferSize: 2, maxColliderBufferSize: 5); |
|
|
|
boxOverlap.Update(); |
|
|
|
Assert.AreEqual(2, boxOverlap.ColliderBuffer.Length); |
|
|
|
|
|
|
|
|
|
|
gridSizeX: 2, |
|
|
|
gridSizeZ: 2, |
|
|
|
rootReference: testGo, |
|
|
|
centerObject: testGo, |
|
|
|
detectableTags: new [] { tag1 }); |
|
|
|
var helper = new VerifyParseCollidersHelper(); |
|
|
|
boxOverlap.GridOverlapDetectedClosest += helper.DetectedAction; |
|
|
|
|
|
|
gridSizeX: 2, |
|
|
|
gridSizeZ: 2, |
|
|
|
rootReference: testGo, |
|
|
|
centerObject: testGo, |
|
|
|
detectableTags: new [] { tag1 }); |
|
|
|
var helper = new VerifyParseCollidersHelper(); |
|
|
|
boxOverlap.GridOverlapDetectedAll += helper.DetectedAction; |
|
|
|