Ejemplo n.º 1
0
        public void AddSource(object key, SourceType type, PPos[] projectedCells)
        {
            if (sources.ContainsKey(key))
            {
                throw new InvalidOperationException("Attempting to add duplicate shroud source");
            }

            sources[key] = new ShroudSource(type, projectedCells);

            foreach (var puv in projectedCells)
            {
                // Force cells outside the visible bounds invisible
                if (!map.Contains(puv))
                {
                    continue;
                }

                var uv = (MPos)puv;
                switch (type)
                {
                case SourceType.PassiveVisibility:
                    passiveVisibilityEnabled = true;
                    passiveVisibleCount[uv]++;
                    explored[uv] = true;
                    break;

                case SourceType.Visibility:
                    visibleCount[uv]++;
                    explored[uv] = true;
                    break;

                case SourceType.Shroud:
                    shroudGenerationEnabled = true;
                    generatedShroudCount[uv]++;
                    break;
                }
            }

            Invalidate(projectedCells);
        }
Ejemplo n.º 2
0
        public void AddSource(object key, SourceType type, PPos[] projectedCells)
        {
            if (sources.ContainsKey(key))
                throw new InvalidOperationException("Attempting to add duplicate shroud source");

            sources[key] = new ShroudSource(type, projectedCells);

            foreach (var puv in projectedCells)
            {
                // Force cells outside the visible bounds invisible
                if (!map.Contains(puv))
                    continue;

                var uv = (MPos)puv;
                switch (type)
                {
                    case SourceType.PassiveVisibility:
                        passiveVisibilityEnabled = true;
                        passiveVisibleCount[uv]++;
                        explored[uv] = true;
                        break;
                    case SourceType.Visibility:
                        visibleCount[uv]++;
                        explored[uv] = true;
                        break;
                    case SourceType.Shroud:
                        shroudGenerationEnabled = true;
                        generatedShroudCount[uv]++;
                        break;
                }
            }

            Invalidate(projectedCells);
        }