private bool CanSeeEntity(Entity origin, Entity target) { bool result = true; TileMap <Cell> map = Locator.Get <MapManager>().Map; IDTools.PlotFunction isClear = (int x, int y) => { bool plotResult = true; Cell cell = map[x, y]; if (cell == null || cell.BreaksLineOfSight()) { plotResult = false; result = false; } return(plotResult); }; int2 actorPosition = target.CellTransform.Position; int2 entityPosition = origin.CellTransform.Position; IDTools.Line(actorPosition.x, actorPosition.y, entityPosition.x, entityPosition.y, isClear); return(result); }
protected override NodeStates Tick(Tick tick) { NodeStates result = NodeStates.Success; TileMap <Cell> map = Locator.Get <MapManager>().Map; IDTools.PlotFunction isClear = (int x, int y) => { bool plotResult = true; Cell cell = map[x, y]; if (cell == null || cell.BreaksLineOfSight()) { plotResult = false; result = NodeStates.Failure; } return(plotResult); }; Entity target = tick.Target as Entity; int2 actorPosition = target.CellTransform.Position; int2 entityPosition = entity.CellTransform.Position; IDTools.Line(actorPosition.x, actorPosition.y, entityPosition.x, entityPosition.y, isClear); return(result); }
private void MakePath(Vector2 origin, Vector2 destiny) { IDTools.PlotFunction plotter = PlacePathPoint; IDTools.Line((int)origin.x, (int)origin.y, (int)destiny.x, (int)destiny.y, plotter); }