示例#1
0
        public void Discover(Point coordinates, int range)
        {
            List <Point> points = new List <Point>();

            foreach (UndiscoveredTile t in UndiscoveredTiles)
            {
                if (t.Hitbox.Contains(coordinates * new Point(TileWidth)))
                {
                    for (int i = t.Coordinates.X - range; i < t.Coordinates.X + range + 1; i++)
                    {
                        for (int j = t.Coordinates.Y - range; j < t.Coordinates.Y + range + 1; j++)
                        {
                            if (i >= 0 && i <= World.Size.X && j >= 0 && j <= World.Size.Y && Utilities.Distance(new Point(i, j), t.Coordinates) <= range)
                            {
                                UndiscoveredTiles[i, j].Discovered = true;
                                points.Add(new Point(i, j));
                            }
                        }
                    }

                    break;
                }
            }

            UndiscoveredTiles.Cast <UndiscoveredTile>().ToList().ForEach(x => x.Fix());
        }
示例#2
0
        public void Update(GameTime gt)
        {
            Time += (float)gt.ElapsedGameTime.TotalSeconds;

            Cards.ForEach(x => x.Update(gt));

            foreach (Card c in Cards)
            {
                if (c.Used)
                {
                    Cards.Remove(c);
                    break;
                }
            }

            if (Debug.DiscoverOnClick && Mouse.CanPress && Mouse.LeftMouseDown)
            {
                Discover(5);
            }

            ExitButton.Update(gt);
            AddCardButton.Update(gt);

            UndiscoveredTiles.Cast <Tile>().ToList().ForEach(x => x.Update(gt));
        }
示例#3
0
        public void GenerateFOW()
        {
            int buffer = 1;

            for (int i = 0; i < UndiscoveredTiles.GetLength(0); i++)
            {
                for (int j = 0; j < UndiscoveredTiles.GetLength(1); j++)
                {
                    if (i <= buffer - 1 || i >= World.Tiles.GetLength(0) - buffer || j <= buffer - 1 || j >= World.Tiles.GetLength(1) - buffer)
                    {
                        UndiscoveredTiles[i, j] = new UndiscoveredTile(true, new Vector2(i * TileWidth, j * TileWidth), UndiscoveredTiles);
                    }
                    else
                    {
                        UndiscoveredTiles[i, j] = new UndiscoveredTile(false, new Vector2(i * TileWidth, j * TileWidth), UndiscoveredTiles);
                    }
                }
            }

            UndiscoveredTiles.Cast <UndiscoveredTile>().ToList().ForEach(x => x.Fix());
        }