摘要: 直线移动时的强迫邻居规定 下面的图中字母的表示:P表示父节点,B表示障碍,X表示当前节点,N表示强迫邻居(Forced Neighbor) 1,向右移动时,左上为障碍时,上方可走则为强迫邻居 2,向右移动时,左下为障碍时,下方可走则为强迫邻居 3,向左移动时,右上为障碍时,上方可走则为强迫邻居 4, 阅读全文
posted @ 2026-06-20 20:49 yanghui01 阅读(4) 评论(0) 推荐(0)
摘要: 强迫邻居 定义:节点X的邻居节点有障碍物,且X的父节点P经过X到达N的距离代价,比不经过X到大N的任一路径的距离代价都小,则称N是X的强迫邻居。 直线移动时的强迫邻居规定 下面的图中字母的表示:P表示父节点,B表示障碍,X表示当前节点,N表示强迫邻居(Forced Neighbor) 1,向右移动时 阅读全文
posted @ 2026-06-19 23:54 yanghui01 阅读(4) 评论(0) 推荐(0)
摘要: 用途:可以用来找Tilemap的一圈边界 public static void FindBoundaryCells(string[, ] cells) { Vector3Int[] fourDirs = //格式: cellX, cellY, bitFlag { new Vector3Int(-1, 阅读全文
posted @ 2026-04-25 00:18 yanghui01 阅读(8) 评论(0) 推荐(0)
摘要: 裁剪ugui的效果 原理:将UIDefault计算裁剪矩形部分的计算,改成裁剪矩形作为圆形的外接矩形 (修改的部分已经全部标蓝) // Unity built-in shader source. Copyright (c) 2016 Unity Technologies. MIT license ( 阅读全文
posted @ 2026-04-24 00:19 yanghui01 阅读(10) 评论(0) 推荐(0)
摘要: 效果 [RequireComponent(typeof(Tilemap))] public class TilemapCustomGizmos : MonoBehaviour { [SerializeField] private Tilemap m_CachedTilemap; public Til 阅读全文
posted @ 2026-04-23 00:18 yanghui01 阅读(11) 评论(0) 推荐(0)
摘要: 一个格子用一个bit保存 这种方式最简单,每个格子都用一个bit记录。 优点:执行速度快,没有额外逻辑 缺点:地图特别大时,数据大小也将线性增大,比如:4096*4096个格子的地图,数据大小为2MB public class CellsDataV1 { public static int Bits 阅读全文
posted @ 2026-04-17 00:32 yanghui01 阅读(6) 评论(0) 推荐(0)
摘要: 为什么要将LuaFunction转为委托? 1、调用起来更方便 2、不需要关心忘记Dispose,造成c#端长时间持有lua层的引用而导致lua层对象无法释放问题 public T LuaFunToDelegate<T>(LuaEnv luaEnv, string luaStr) where T : 阅读全文
posted @ 2026-04-15 00:19 yanghui01 阅读(7) 评论(0) 推荐(0)
摘要: lua表 local obj = { 1, ["a"] = "A", 2, ["b"] = "B", 3, } Cast执行后的结果 var dict1 = luaObj.Cast<Dictionary<string, string>>(); Debug.Log($"keys cnt: {dict1 阅读全文
posted @ 2026-03-29 00:03 yanghui01 阅读(8) 评论(0) 推荐(0)
摘要: public static bool IsPureArray(LuaTable table) { int maxIndex = 0; int count = 0; bool hasNonInteger = false; table.ForEach<object, object>((key, valu 阅读全文
posted @ 2026-03-29 00:01 yanghui01 阅读(7) 评论(0) 推荐(0)
摘要: 测试代码 public class DisableInPrefabDemo : MonoBehaviour { [DisableInPrefabInstances] //预制体实例Inspector中禁用 public GameObject m_Prefab; [DisableInPrefabAss 阅读全文
posted @ 2026-03-12 23:03 yanghui01 阅读(8) 评论(0) 推荐(0)