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.

72 lines
2.3 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 widthIn = 0; //Width at the entrance, including external wals
  8. public int widthOut = 0; //Width at the exit, including external walls
  9. public int widthMax = 0; //Greatest width at any point (including external walls)
  10. public int length = 0;
  11. int size;
  12. public int difficultyMin; //The lowest difficulty rating that this section can appear on
  13. public int difficultyMax; //And the highest
  14. public int weight = 1; //How many copies of this section should go on the list?
  15. //Lists of spawn points
  16. //One for each possible number of players
  17. public List<GameObject> spawns1;
  18. public List<GameObject> spawns2;
  19. public List<GameObject> spawns3;
  20. public List<GameObject> spawns4;
  21. public List<GameObject> spawns5;
  22. public List<GameObject> spawns6;
  23. public List<GameObject> spawns7;
  24. public List<GameObject> spawns8;
  25. public List<GameObject> entrances; //Ways into this map segment
  26. public List<GameObject> exits; //Ways out of this map segment
  27. public List<GameObject> collectableSpawns; //Which blocks can items spawn on?
  28. // Start is called before the first frame update
  29. void Start()
  30. {
  31. }
  32. public void InitSection()
  33. {
  34. size = widthMax * length;
  35. foreach (GameObject block in collectableSpawns)
  36. {
  37. block.GetComponent<Block>().isCollectableSpawnable = true;
  38. }
  39. }
  40. public void InitSection(int num)
  41. {
  42. name = num + " " + name;
  43. InitSection();
  44. }
  45. public int getSize()
  46. {
  47. return size;
  48. }
  49. public void destroySection()
  50. {
  51. /*foreach (GameObject block in blocks)
  52. {
  53. Object.Destroy(block);
  54. }*/
  55. /*Debug.Log("Destroying section " + name + ", position = " + transform.position.x + ", " + transform.position.y + ", " + transform.position.z);
  56. gameObject.transform.position = new Vector3(0.0f, 0.0f, 1000.0f);*/
  57. Debug.Log("Destroying section " + name + ", position = " + transform.position.x + ", " + transform.position.y + ", " + transform.position.z);
  58. //gameObject.SetActive(false);
  59. Destroy(gameObject);
  60. }
  61. }