frica-de-gaze/FricaDeGaze/Assets/Scripts/AddSpider.cs

35 lines
698 B
C#
Raw Permalink Normal View History

2015-01-14 10:31:17 +00:00
using UnityEngine;
using System.Collections;
public class AddSpider : MonoBehaviour {
// Use this for initialization
public GameObject enemy;
public SpiderMove sc;
float randomInterval = 5.0f;
IEnumerator Start()
{
while(true)
{
yield return new WaitForSeconds(Random.Range(randomInterval, 2 * randomInterval));
if (randomInterval > .2f)
randomInterval -= randomInterval / 10;
Instantiate(enemy);
float scale = Random.Range(.5f / randomInterval, .5f / randomInterval);
enemy.transform.position = new Vector3(-4, 0, -4);
enemy.transform.localScale = new Vector3(scale, scale, scale);
}
}
// Update is called once per frame
void Update () {
}
}