17 lines
356 B
C#
17 lines
356 B
C#
|
|
using UnityEngine;
|
||
|
|
|
||
|
|
public class SpawnZone : MonoBehaviour
|
||
|
|
{
|
||
|
|
public BoxCollider area;
|
||
|
|
|
||
|
|
public Vector3 GetRandomPosition()
|
||
|
|
{
|
||
|
|
Bounds bounds = area.bounds;
|
||
|
|
return new Vector3(
|
||
|
|
Random.Range(bounds.min.x, bounds.max.x),
|
||
|
|
bounds.center.y,
|
||
|
|
Random.Range(bounds.min.z, bounds.max.z)
|
||
|
|
);
|
||
|
|
}
|
||
|
|
}
|