コード例 #1
0
ファイル: Team.cs プロジェクト: matttheawesome1/Battle-Reign
        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
ファイル: Team.cs プロジェクト: matttheawesome1/Battle-Reign
        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
ファイル: Team.cs プロジェクト: matttheawesome1/Battle-Reign
        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());
        }