Skip to content

Instantly share code, notes, and snippets.

@bzgeb
Created October 31, 2012 14:22
Show Gist options
  • Save bzgeb/3987298 to your computer and use it in GitHub Desktop.
Save bzgeb/3987298 to your computer and use it in GitHub Desktop.
Poops
using UnityEngine;
using System.Collections;
public class TrailerTarget : MonoBehaviour {
public Transform[] positions;
public float[] times;
private int current_index;
IEnumerator OnTrailer()
{
int i = 0;
for(i = 0; i < positions.Length; ++i)
{
yield return new WaitForSeconds(times[i]);
transform.position = positions[i].position;
current_index = i;
}
}
void Start ()
{
StartCoroutine(OnTrailer());
}
void Update ()
{
transform.position = positions[current_index].position;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment