Advertisement
Guest User

Untitled

a guest
Sep 25th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.54 KB | None | 0 0
  1.  
  2.  
  3.  
  4. public int TileID
  5. {
  6.     get { return BaseTiles.Count > 0 ? BaseTiles[0] : 0; }
  7.     set
  8.     {
  9.         if (BaseTiles.Count > 0)
  10.             BaseTiles[0] = value;
  11.         else
  12.             AddBaseTile(value);
  13.     }
  14. }
  15.  
  16. when setting we make sure there is at least one tile in the BaseTiles list and set it to the passed value. If there isn't, we create one with the passed value. Of course, we will need to add the AddBaseTile helper function to our MapCell class:
  17.  
  18. public void AddBaseTile(int tileID)
  19. {
  20.    BaseTiles.Add(tileID);
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement