PopulationSystemManager.cs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. using UnityEngine;
  2. using System.Collections;
  3. #if UNITY_EDITOR
  4. using UnityEditor;
  5. #endif
  6. public class PopulationSystemManager : MonoBehaviour
  7. {
  8. [SerializeField] private GameObject planePrefab;
  9. [SerializeField] private GameObject circlePrefab;
  10. public GameObject pointPrefab;
  11. [HideInInspector]
  12. public bool isConcert;
  13. [HideInInspector]
  14. public bool isStreet;
  15. [HideInInspector]
  16. public Vector3 mousePos;
  17. public void Concert(Vector3 pos)
  18. {
  19. isConcert = false;
  20. var emptyObject = new GameObject();
  21. emptyObject.transform.position = pos;
  22. emptyObject.name = "Audience";
  23. #if UNITY_EDITOR
  24. Selection.activeGameObject = emptyObject;
  25. #endif
  26. emptyObject.AddComponent<StandingPeopleConcert>();
  27. var _StandingPeopleConcert = emptyObject.GetComponent<StandingPeopleConcert>();
  28. _StandingPeopleConcert.planePrefab = planePrefab;
  29. _StandingPeopleConcert.circlePrefab = circlePrefab;
  30. _StandingPeopleConcert.SpawnRectangleSurface();
  31. #if UNITY_EDITOR
  32. Selection.activeGameObject = emptyObject;
  33. ActiveEditorTracker.sharedTracker.isLocked = false;
  34. #endif
  35. }
  36. public void Street(Vector3 pos)
  37. {
  38. isStreet = false;
  39. var emptyObject = new GameObject();
  40. emptyObject.transform.position = pos;
  41. emptyObject.name = "Talking people";
  42. #if UNITY_EDITOR
  43. Selection.activeGameObject = emptyObject;
  44. #endif
  45. emptyObject.AddComponent<StandingPeopleStreet>();
  46. var _StandingPeopleStreet = emptyObject.GetComponent<StandingPeopleStreet>();
  47. _StandingPeopleStreet.planePrefab = planePrefab;
  48. _StandingPeopleStreet.circlePrefab = circlePrefab;
  49. _StandingPeopleStreet.SpawnRectangleSurface();
  50. #if UNITY_EDITOR
  51. Selection.activeGameObject = emptyObject;
  52. ActiveEditorTracker.sharedTracker.isLocked = false;
  53. #endif
  54. }
  55. }