Example #1
0
        /// <summary>Creates a new instance of FogOfWar.</summary>
        /// <param name="rows">The number of rows.</param>
        /// <param name="cols">The number of columns.</param>
        /// <param name="worldSize">The size of the world.</param>
        /// <param name="owner">The player that owns this fog of war.</param>
        public FogOfWar(int rows, int cols, VectorF worldSize, Player owner)
        {
            clear();

            Owner = owner;
            Grid = new VisOption[rows, cols];

            // set grid square size
            SqrSize = new VectorF(worldSize.X / (FInt)cols, worldSize.Y / (FInt)rows);
            SqrSizeHalf = SqrSize / FInt.F2;

            // begin unexplored
            resetTo(VisOption.Unexplored);

            // only use drawn if human
            drawn = (owner.Type == Player.PlayerType.Human) ? new bool[rows, cols] : null;
        }
Example #2
0
 /// <summary>Resets all values in the grid to the specified visibliity option.</summary>
 /// <param name="visibility">The visibility option to set.</param>
 public void resetTo(VisOption visibility)
 {
     for (int row = 0; row < NumRows; row++)
     {
         for (int col = 0; col < NumCols; col++)
         {
             Grid[row, col] = VisOption.Unexplored;
         }
     }
 }