Guest User

Untitled

a guest
Nov 17th, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. public class TileTest : MonoBehaviour {
  2.  
  3. public Tile tile;
  4. private Tilemap tilemap;
  5.  
  6. public int currentSize;
  7.  
  8.  
  9. void Start () {
  10. tilemap = GetComponent<Tilemap>;
  11. Grow();
  12. }
  13.  
  14. void Update() {
  15.  
  16. for (var i = 0; i < 100; i++) {
  17. Grow();
  18. }
  19. Debug.Log(currentSize);
  20. }
  21.  
  22. private void Grow() {
  23. for (int x = 0; x < currentSize; x++) {
  24. tilemap.SetTile(new Vector3Int(x, currentSize, 0), tile);
  25. }
  26. for (int y = 0; y < currentSize; y++) {
  27. tilemap.SetTile(new Vector3Int(currentSize, y, 0), tile);
  28. }
  29. tilemap.SetTile(new Vector3Int(currentSize, currentSize, 0), tile);
  30.  
  31. currentSize++;
  32. }
  33. }
  34.  
  35. public class TileTest : MonoBehaviour {
  36.  
  37. public Tile tile;
  38. private Tilemap tilemap;
  39. public int currentSize;
  40.  
  41.  
  42. void Start () {
  43. tilemap = GetComponentInChildren<Tilemap>();
  44. }
  45.  
  46. void Update() {
  47. tilemap.SetTile(new Vector3Int(currentSize, currentSize, 0), tile);
  48. currentSize+= 100;
  49. }
  50. }
Add Comment
Please, Sign In to add comment