5个版本
0.2.0 | 2022年9月23日 |
---|---|
0.1.4 | 2022年5月25日 |
0.1.3 | 2022年1月14日 |
0.1.1 | 2021年12月26日 |
0.1.0 | 2021年12月26日 |
#1470 在 游戏开发
24 每月下载
140KB
342 行
Adam Millazo的FOV算法的实现
要使用它,您必须在您的地图类型上实现VisibilityMap
特质,或使用内置的VisibilityMap2d
。然后,您可以使用您的地图调用fov::compute
,这将根据地图的不透明瓷砖填充可见瓷砖。
示例
use adam_fov_rs::*;
// Create a 50x50 visibility map
let mut map = VisibilityMap2d::default([50,50]);
// Set the tile at (15,15) to opaque
map[[15,15]].opaque = true;
// Compute our visible tiles and add them to the map
fov::compute([15,14], 5, &mut map);
// The space directly above our opaque tile is not visible
assert!(map[[15,16]].visible == false);
取自“终端”示例
依赖项
~3.5MB
~100K SLoC