using Godot; using GoDotTest; using System.Diagnostics; using System.Linq; using Xunit; public class NavigationComponentTests : TestClass { private Node _testScene = null; private TileWorld _tileWorld; private NavigationComponent _navigationComponent; private KinematicBody _kinematicBody; private PackedScene _tileWorldScene = GD.Load("res://scenes/TileWorld.tscn"); public NavigationComponentTests(Node testScene) : base(testScene) { _testScene = testScene; } [Setup] public void Setup() { _tileWorld = (TileWorld)_tileWorldScene.Instance(); _tileWorld.HexGrid = new HexGrid(); _testScene.AddChild(_tileWorld); _kinematicBody = new KinematicBody(); _navigationComponent = new NavigationComponent(); _navigationComponent.TileWorld = _tileWorld; } [Test] public void SimpleTest() { _tileWorld.HexGrid.AddObstacle(HexCell.FromOffsetCoords(new Vector2 (-4, 7))); Vector3 startPoint = new Vector3(-2.25f, 1.2f, -4.76314f); Vector3 endPoint = new Vector3(-2.533157f, 1.2f, -5.872417f); bool isBlocked = _navigationComponent.CheckSweptTriangleCellCollision(startPoint, endPoint, 0.27f); } }