Start refactoring of spawn generator

This commit is contained in:
cyber-dream 2022-06-03 12:29:00 +03:00
parent ad86ef1537
commit ed02e7a974

View File

@ -10,7 +10,7 @@ public class OverMind : MonoBehaviour
[SerializeField] private Gameplay gamePlay; [SerializeField] private Gameplay gamePlay;
// [SerializeField] private GameObject mobPull; // [SerializeField] private GameObject mobPull;
[SerializeField] private GameObject activeMobs;
private float balanceScale = 1f; private float balanceScale = 1f;
private List<GameObject> _pullEnemies; private List<GameObject> _pullEnemies;
@ -41,6 +41,9 @@ public struct MobParameters
} }
[SerializeField] private List<MobParameters> mobs; [SerializeField] private List<MobParameters> mobs;
private GameObject mobsObject;
private GameObject activeMobs;
// [SerializeField] private MobParameters standartMob; // [SerializeField] private MobParameters standartMob;
// [SerializeField] private MobParameters lightMob; // [SerializeField] private MobParameters lightMob;
// [SerializeField] private MobParameters heavyMob; // [SerializeField] private MobParameters heavyMob;
@ -52,10 +55,15 @@ void Start()
print(GenerateSpawnRegions().TopRegion); print(GenerateSpawnRegions().TopRegion);
generatedSpawnRegions = GenerateSpawnRegions(); generatedSpawnRegions = GenerateSpawnRegions();
mobsObject = Instantiate(new GameObject());
mobsObject.name = "Mobs";
mobsObject.transform.parent = transform;
//activeMobs = new GameObject
} }
public SpawnRegions GenerateSpawnRegions() private static SpawnRegions GenerateSpawnRegions()
{ {
const float spawnBorder = 2f; const float spawnBorder = 2f;
var stageDimensions = Camera.main.ScreenToWorldPoint(new Vector3(Screen.width, Screen.height,0)); var stageDimensions = Camera.main.ScreenToWorldPoint(new Vector3(Screen.width, Screen.height,0));
@ -122,7 +130,7 @@ private Vector4 PickRandomSpawnBorder()
// } // }
// } // }
Vector3 GenerateRandomSpawnMobPoint() private Vector3 GenerateRandomSpawnMobPoint()
{ {
var _randomSpawnRegion = PickRandomSpawnBorder(); var _randomSpawnRegion = PickRandomSpawnBorder();
var spawnPoint = new Vector3( var spawnPoint = new Vector3(