Ejemplo n.º 1
0
 ///<summary>Gets or sets the probability that a cell is occupied, between 0 and 1.</summary>
 public double this[Location location] {
     get {
         MapCell cell = cells.Get(location);
         return(cell == null ? 0 : cell.Probability);
     }
     set {
         if (value == 0)
         {
             cells.Remove(location);
         }
         else
         {
             MapCell cell = cells.Get(location);
             if (cell == null)
             {
                 cells.Add(new MapCell(location)
                 {
                     Probability = value
                 });
             }
             else
             {
                 cell.Probability = value;
             }
         }
     }
 }