You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

81 lines
2.4 KiB

  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class MapSection : MonoBehaviour
  5. {
  6. public int width = 0;
  7. public int length = 0;
  8. int size;
  9. public string sectionName = "";
  10. //Lists of each type of block, assigned in the inspector
  11. public List<GameObject> boulders;
  12. public List<GameObject> belts;
  13. public List<GameObject> cannons;
  14. public List<GameObject> pits;
  15. public List<GameObject> spawns;
  16. public List<GameObject> spikes;
  17. public List<GameObject> track;
  18. public List<GameObject> walls;
  19. public List<GameObject> water;
  20. public List<GameObject> blocks; //Complete list of all blocks, cleared & filled on creation
  21. public List<GameObject> entrances; //Ways into this map segment
  22. public List<GameObject> exits; //Ways out of this map segment
  23. // Start is called before the first frame update
  24. void Start()
  25. {
  26. }
  27. public void InitSection()
  28. {
  29. size = width * length;
  30. blocks = new List<GameObject>();
  31. blocks.AddRange(boulders);
  32. blocks.AddRange(belts);
  33. blocks.AddRange(cannons);
  34. blocks.AddRange(pits);
  35. blocks.AddRange(spawns);
  36. blocks.AddRange(spikes);
  37. blocks.AddRange(track);
  38. blocks.AddRange(walls);
  39. blocks.AddRange(water);
  40. }
  41. public void InitSection(int num)
  42. {
  43. name = num + " " + name;
  44. size = width * length;
  45. blocks = new List<GameObject>();
  46. blocks.AddRange(boulders);
  47. blocks.AddRange(belts);
  48. blocks.AddRange(cannons);
  49. blocks.AddRange(pits);
  50. blocks.AddRange(spawns);
  51. blocks.AddRange(spikes);
  52. blocks.AddRange(track);
  53. blocks.AddRange(walls);
  54. blocks.AddRange(water);
  55. }
  56. public int getSize()
  57. {
  58. return size;
  59. }
  60. public void destroySection()
  61. {
  62. /*foreach (GameObject block in blocks)
  63. {
  64. Object.Destroy(block);
  65. }*/
  66. /*Debug.Log("Destroying section " + name + ", position = " + transform.position.x + ", " + transform.position.y + ", " + transform.position.z);
  67. gameObject.transform.position = new Vector3(0.0f, 0.0f, 1000.0f);*/
  68. Debug.Log("Destroying section " + name + ", position = " + transform.position.x + ", " + transform.position.y + ", " + transform.position.z);
  69. //gameObject.SetActive(false);
  70. Destroy(gameObject);
  71. }
  72. }