Exemplo n.º 1
0
        private void CalcBlockedLineOfSight(Wmap map)
        {
            _sCircle.Clear();
            foreach (var ray in _sightRays)
            {
                for (var i = 0; i < ray.Value.Length; i++)
                {
                    _ip.X = LastX + ray.Value[i].X;
                    _ip.Y = LastY + ray.Value[i].Y;

                    if (!map.Contains(_ip))
                    {
                        continue;
                    }

                    _sCircle.Add(_ip);

                    var t = map[_ip.X, _ip.Y];
                    if (t.ObjType != 0 && t.ObjDesc != null && t.ObjDesc.BlocksSight)
                    {
                        break;
                    }
                    foreach (var sPoint in SurroundingPoints)
                    {
                        IntPoint _intPoint = new IntPoint(sPoint.X + _ip.X, sPoint.Y + _ip.Y);
                        if (map.Contains(_intPoint))
                        {
                            _sCircle.Add(_intPoint);
                        }
                    }
                }
            }
        }
Exemplo n.º 2
0
        private void CalcUnblockedSight(Wmap map)
        {
            _sCircle.Clear();
            foreach (var p in _unblockedView)
            {
                _ip.X = LastX + p.X;
                _ip.Y = LastY + p.Y;

                if (!map.Contains(_ip))
                {
                    continue;
                }

                _sCircle.Add(_ip);
            }
        }
Exemplo n.º 3
0
        private static void CalcRegion(Wmap map, int pIndex, int sx, int sy)
        {
            VisibleTilesList.Clear();
            VisibleTilesSet.Clear();

            var p     = new IntPoint(sx, sy);
            var prime = Primes[pIndex];

            map[p.X, p.Y].SightRegion = prime;

            VisibleTilesList.Add(p);

            for (var i = 0; i < VisibleTilesList.Count; i++)
            {
                var op = VisibleTilesList[i];
                foreach (var sp in SurroundingPoints)
                {
                    p.X = op.X + sp.X;
                    p.Y = op.Y + sp.Y;

                    if (!map.Contains(p) || VisibleTilesSet.Contains(p))
                    {
                        continue;
                    }

                    VisibleTilesSet.Add(p);

                    var t = map[p.X, p.Y];

                    if (IsBlocking(t))
                    {
                        checked { t.SightRegion *= prime; }
                        continue;
                    }

                    t.SightRegion = prime;
                    VisibleTilesList.Add(p);
                }
            }
        }
Exemplo n.º 4
0
        private void CalcRegionBlockSight(Wmap map)
        {
            var sRegion = map[LastX, LastY].SightRegion;

            _sCircle.Clear();
            foreach (var p in _unblockedView)
            {
                _ip.X = LastX + p.X;
                _ip.Y = LastY + p.Y;

                if (!map.Contains(_ip))
                {
                    continue;
                }

                var t = map[_ip.X, _ip.Y];
                if (t.SightRegion % sRegion == 0)
                {
                    _sCircle.Add(_ip);
                }
            }
        }