Exemple #1
0
        public override void ClearFogOfWar(Unit o)
        {
            int max;

            Position[] tiles = BoardObject.RangeSpiral(o.ViewRange, out max);
            bool[,] fow = players[o.ObjectID.PlayerID].FogOfWar;
            for (int i = 0; i < max; i++)
            {
                Position p = tiles[i];
                int      x = p.X + o.Position.X;
                int      y = p.Y + o.Position.Y;

                if (x < 0 || y < 0 || x > _map.Width - 1 || y > _map.Height - 1)
                {
                    continue;
                }
                fow[x, y] = false;
            }
        }
Exemple #2
0
        public override void Test()
        {
            int limit;

            Position[] p;
            System.Console.Out.WriteLine("#0");
            p = BoardObject.RangeSpiral(0, out limit);
            if (limit != 1)
            {
                throw new TestException(limit + " - zly limit");
            }
            System.Console.Out.WriteLine("#1");
            p = BoardObject.RangeSpiral(1, out limit);

            foreach (Position pos in p)
            {
                System.Console.Out.WriteLine(pos.X + " " + pos.Y);
            }
            if (limit != 9)
            {
                throw new TestException(limit + " - zly limit");
            }
            System.Console.Out.WriteLine("#2");
            p = BoardObject.RangeSpiral(2, out limit);
            foreach (Position pos in p)
            {
                //System.Console.Out.WriteLine(pos.X + " " + pos.Y);
            }
            if (limit != 21)
            {
                throw new TestException(limit + " - zly limit");
            }
            int c;

            p = BoardObject.RangeSpiral(30, out c);

            System.Console.Out.WriteLine("############## " + c);
            if (c != 2895)
            {
                System.Console.Out.WriteLine("Dzwon do radzia");
            }
        }