33 lines
695 B
C#
33 lines
695 B
C#
using UnityEngine;
|
|
|
|
public class MegaSpawnTest : MonoBehaviour
|
|
{
|
|
public GameObject spawnobj;
|
|
|
|
public Vector3 range = new Vector3(4f, 0f, 4f);
|
|
|
|
public float time = 1.7317f;
|
|
|
|
private float t;
|
|
|
|
private void Update()
|
|
{
|
|
t += Time.deltaTime;
|
|
if (t > time)
|
|
{
|
|
t -= time;
|
|
Vector3 zero = Vector3.zero;
|
|
zero.x = Random.Range(0f - range.x, range.x);
|
|
zero.y = Random.Range(0f - range.y, range.y);
|
|
zero.z = Random.Range(0f - range.z, range.z);
|
|
GameObject gameObject = MegaCopyObject.DeepCopy(spawnobj);
|
|
gameObject.transform.position = zero;
|
|
MegaMorph component = gameObject.GetComponent<MegaMorph>();
|
|
if ((bool)component)
|
|
{
|
|
component.animtime = 0f;
|
|
}
|
|
}
|
|
}
|
|
}
|