Пример #1
0
        public bool RecalculateAllPaths()
        {
            foreach (var path in _pathGroup)
            {
                List <Vector3> compact;
                List <Vector3> detailed;
                path.Recalculate(out compact, out detailed, TeamGroup);
                if (compact.Count == 0 && detailed.Count == 0)
                {
                    return(false);
                }

                if (path.CompactPath.Count != compact.Count)
                {
                    path.PathCounter++;
                }
                else if (compact.Where((t, it) => t != path.CompactPath[it]).Any())
                {
                    path.PathCounter++;
                }
                path.SetAStarPath(compact, detailed);
            }


            if (_debugger == null)
            {
                return(true);
            }
            _debugger.ClearDebugCubes(gameObject.name + " _pathObject Debug_" + _toggle);
            _toggle = !_toggle;
            foreach (var loc in _pathGroup.SelectMany(path => path.CompactPath))
            {
                _debugger.DebugCube(loc, Color.green, gameObject.name + " _pathObject Debug_" + _toggle, 5);
            }
            return(true);
        }