IsVisible() public method

public IsVisible ( CPos cell ) : bool
cell CPos
return bool
Example #1
0
		public void Tick(World world, Shroud shroud)
		{
			Visible = true;
			foreach (var pos in Footprint)
			{
				if (shroud.IsVisible(pos))
				{
					Visible = false;
					break;
				}
			}

			if (flashTicks > 0)
				flashTicks--;
		}
Example #2
0
        static int FoggedEdges(Shroud s, CPos p, bool useExtendedIndex)
        {
            if (!s.IsVisible(p.X, p.Y))
                return 15;

            // If a side is shrouded then we also count the corners
            var u = 0;
            if (!s.IsVisible(p.X, p.Y - 1)) u |= 0x13;
            if (!s.IsVisible(p.X + 1, p.Y)) u |= 0x26;
            if (!s.IsVisible(p.X, p.Y + 1)) u |= 0x4C;
            if (!s.IsVisible(p.X - 1, p.Y)) u |= 0x89;

            var uside = u & 0x0F;
            if (!s.IsVisible(p.X - 1, p.Y - 1)) u |= 0x01;
            if (!s.IsVisible(p.X + 1, p.Y - 1)) u |= 0x02;
            if (!s.IsVisible(p.X + 1, p.Y + 1)) u |= 0x04;
            if (!s.IsVisible(p.X - 1, p.Y + 1)) u |= 0x08;

            // RA provides a set of frames for tiles with shrouded
            // corners but unshrouded edges. We want to detect this
            // situation without breaking the edge -> corner enabling
            // in other combinations. The XOR turns off the corner
            // bits that are enabled twice, which gives the behavior
            // we want here.
            return useExtendedIndex ? u ^ uside : u & 0x0F;
        }
        public void Tick(World world, Shroud shroud)
        {
            Visible = !Footprint.Any(c => shroud.IsVisible(c));

            if (flashTicks > 0)
                flashTicks--;
        }
Example #4
0
        Sprite ChooseFog(Shroud s, int i, int j)
        {
            if (!s.IsVisible(i, j)) return shadowBits[0xf];
            if (!s.IsExplored(i, j)) return shadowBits[0xf];

            // bits are for unexploredness: up, right, down, left
            var v = 0;
            // bits are for unexploredness: TL, TR, BR, BL
            var u = 0;

            if (!s.IsVisible(i, j - 1)) { v |= 1; u |= 3; }
            if (!s.IsVisible(i + 1, j)) { v |= 2; u |= 6; }
            if (!s.IsVisible(i, j + 1)) { v |= 4; u |= 12; }
            if (!s.IsVisible(i - 1, j)) { v |= 8; u |= 9; }

            var uSides = u;

            if (!s.IsVisible(i - 1, j - 1)) u |= 1;
            if (!s.IsVisible(i + 1, j - 1)) u |= 2;
            if (!s.IsVisible(i + 1, j + 1)) u |= 4;
            if (!s.IsVisible(i - 1, j + 1)) u |= 8;

            return shadowBits[SpecialShroudTiles[u ^ uSides][v]];
        }