Created
October 31, 2012 14:22
-
-
Save bzgeb/3987298 to your computer and use it in GitHub Desktop.
Poops
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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