Skip to content
Permalink
ee3ac1d8d3
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
42 lines (32 sloc) 1.47 KB
using UnityEngine;
using System.Collections;
public class LegosteroidSpawner : MonoBehaviour {
public GameObject asteroid;
public GameObject spawnAsteroid1;
public GameObject spawnAsteroid2;
public GameObject spawnAsteroid3;
public GameObject spawnAsteroid4;
// Use this for initialization
void Start ()
{
StartCoroutine(AsteroidSpawn());
}
IEnumerator AsteroidSpawn()
{
yield return new WaitForSeconds(5f);
spawnAsteroid1 = (GameObject)Instantiate(asteroid, new Vector3(-20.02866f, 11.89162f, 10f), Quaternion.identity);
iTween.MoveTo(spawnAsteroid1, new Vector3(31.74726f, -10.16816f, 10f), 10);
yield return new WaitForSeconds(3f);
spawnAsteroid1 = (GameObject)Instantiate(asteroid, new Vector3(-5.576063f, 14.47898f, 10f), Quaternion.identity);
iTween.MoveTo(spawnAsteroid1, new Vector3(-18.1424f, -11.79514f, 10f), 10);
yield return new WaitForSeconds(7f);
spawnAsteroid1 = (GameObject)Instantiate(asteroid, new Vector3(-19.92406f, 5.991251f, 10f), Quaternion.identity);
iTween.MoveTo(spawnAsteroid1, new Vector3(28.23111f, 10.77588f, 10f), 10);
yield return new WaitForSeconds(5f);
spawnAsteroid1 = (GameObject)Instantiate(asteroid, new Vector3(19.55236f, 14.41265f, 10f), Quaternion.identity);
iTween.MoveTo(spawnAsteroid1, new Vector3(5.40216f, -5.104211f, 10f), 10);
}
// Update is called once per frame
void Update () {
}
}