コード例 #1
0
        protected AStarNode CreateNodeFromIfValid(int x, int y)
        {
            if (!_pathingGrid.IsWalkable(x, y))
            {
                return(null);
            }

            int hashCode = Maths.GetCantorPair(x, y);

            if (_cache.TryGetValue(hashCode, out AStarNode node))
            {
                return(node);
            }
            var newNode = new AStarNode(x, y);

            _cache.Add(hashCode, newNode);
            return(newNode);
        }