Esempio n. 1
0
        /// <summary>
        /// Reset old PathFinding path from the cells.
        /// </summary>
        public void ClearLogic()
        {
            // Reset some information about the cells.
            if (cells == null)
            {
                cells = new WorldCellInfo[links.Length];
            }
            for (int i = 0; i < cells.Length; i++)
            {
                if (cells[i] == null)
                {
                    cells[i] = null;
                }

                cells[i].distanceSteps = DEFAULT_DISTANCE;
                cells[i].isInPath      = false;
            }

            if (PathResult == null)
            {
                PathResult = new List <int>();
            }
            else
            {
                PathResult.Clear();
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Выдача области видимости вокруг начальной точки. (квадрат)
        /// </summary>
        /// <param name="x">Координата X центральной точки области.</param>
        /// <param name="y">Координата Y центральной точки области.</param>
        /// <param name="radius">Количество точек видимости в каждую сторону.</param>
        private WorldInfo ProcessWorld(int x, int y, int radius)
        {
            var res = new WorldInfo(radius);

            for (int dx = -radius; dx <= radius; dx++)
            {
                for (int dy = -radius; dy <= radius; dy++)
                {
                    var w = _world[x + dx, y + dy];
                    res[dx, dy] = new WorldCellInfo
                    {
                        Ci = w.Ci,
                        BeingCharacteristics = (w.BeingValue == null) ? null : w.BeingValue.Characteristics
                    };
                }
            }
            return(res);
        }
        /// <summary>
        /// Reset old PathFinding path from the cells.
        /// </summary>
        public void ClearLogic()
        {
            // Reset some information about the cells.
            if (cells == null)
                cells = new WorldCellInfo[links.Length];
            for (int i = 0; i < cells.Length; i++)
            {
                if (cells[i] == null)
                {
                    cells[i] = null;
                }

                cells[i].distanceSteps = DEFAULT_DISTANCE;
                cells[i].isInPath = false;
            }

            if (PathResult == null)
                PathResult = new List<int>();
            else
                PathResult.Clear();
        }