public override void ResetArea(PersonalityQuarksArea area) { foreach (GameObject go in Spawned) { GameObject.Destroy(go); } Spawned.Clear(); int SpawnNumber = (int)AcademyParameters.FetchOrParse(area.academy, SpawnNumberKeyVal); for (int i = 0; i < SpawnNumber; i++) { GameObject gob = GameObject.Instantiate(Actor, new Vector3( Random.Range(-SpawnRange, SpawnRange), area.StartY + 0.5f, Random.Range(-SpawnRange, SpawnRange)), Quaternion.identity, area.gameObject.transform); if (area.EventSystem != null) { area.EventSystem.RaiseEvent(CreateEvent.Create(Actor.name, gob)); } Spawned.Add(gob); } }
private void SpawnWall(PersonalityQuarksArea area, Vector2 position) { GameObject prefab = Walls[(int)Random.Range(0, Walls.Length)]; float SpawnHeight = prefab.transform.position.y; Quaternion rot = prefab.transform.rotation * Quaternion.AngleAxis(Random.Range(0, 360), Vector3.up); GameObject wall = GameObject.Instantiate( prefab, new Vector3(position.x, area.StartY + SpawnHeight, position.y), rot, area.gameObject.transform); if (area.EventSystem != null) { area.EventSystem.RaiseEvent(CreateEvent.Create(prefab.name, wall)); } Spawned.Add(wall); }