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 spawn points
  11. //One for each possible number of players
  12. public List<GameObject> spawns1;
  13. public List<GameObject> spawns2;
  14. public List<GameObject> spawns3;
  15. public List<GameObject> spawns4;
  16. public List<GameObject> spawns5;
  17. public List<GameObject> spawns6;
  18. public List<GameObject> spawns7;
  19. public List<GameObject> spawns8;
  20. //Lists of each type of block, assigned in the inspector
  21. public List<GameObject> boulders;
  22. public List<GameObject> belts;
  23. public List<GameObject> cannons;
  24. public List<GameObject> pits;
  25. public List<GameObject> spikes;
  26. public List<GameObject> track;
  27. public List<GameObject> walls;
  28. public List<GameObject> water;
  29. public List<GameObject> blocks; //Complete list of all blocks, cleared & filled on creation
  30. public List<GameObject> entrances; //Ways into this map segment
  31. public List<GameObject> exits; //Ways out of this map segment
  32. // Start is called before the first frame update
  33. void Start()
  34. {
  35. }
  36. public void InitSection()
  37. {
  38. size = width * length;
  39. blocks = new List<GameObject>();
  40. blocks.AddRange(boulders);
  41. blocks.AddRange(belts);
  42. blocks.AddRange(cannons);
  43. blocks.AddRange(pits);
  44. //blocks.AddRange(spawns);
  45. blocks.AddRange(spikes);
  46. blocks.AddRange(track);
  47. blocks.AddRange(walls);
  48. blocks.AddRange(water);
  49. }
  50. public void InitSection(int num)
  51. {
  52. name = num + " " + name;
  53. InitSection();
  54. }
  55. public int getSize()
  56. {
  57. return size;
  58. }
  59. public void destroySection()
  60. {
  61. /*foreach (GameObject block in blocks)
  62. {
  63. Object.Destroy(block);
  64. }*/
  65. /*Debug.Log("Destroying section " + name + ", position = " + transform.position.x + ", " + transform.position.y + ", " + transform.position.z);
  66. gameObject.transform.position = new Vector3(0.0f, 0.0f, 1000.0f);*/
  67. Debug.Log("Destroying section " + name + ", position = " + transform.position.x + ", " + transform.position.y + ", " + transform.position.z);
  68. //gameObject.SetActive(false);
  69. Destroy(gameObject);
  70. }
  71. }