Question by
Ninjix3 · Mar 07, 2018 at 11:52 PM ·
particlesystemcoroutinessine-wave
Coroutine for particle system Itween path?
I am very new to C# and Itween. How can I make my particle system repeat it's path as if on a loop? I used a coroutine but it only still seems to play once. I even looked into -"looptype",iTween.LoopType.pingPong));. However, I'm still confused on how to paraphrase this into my script.
public string pathName;
public float time;
// Use this for initialization
void Start () {
//StartCoroutine (LoopVFX());
iTween.MoveTo( gameObject, iTween.Hash("Path", iTweenPath.GetPath (pathName),"easetype",iTween.EaseType.easeInOutSine, "time", time));
}
//Update is called once per frame
void Update () {
StartCoroutine (LoopLine ());
}
IEnumerator LoopLine (){
int waitWindTime = 10;
int loopCount = 30;
for (int i = 0; i< loopCount; i++){
yield return new WaitForSeconds (waitWindTime);
}
}
}
Comment
Best Answer
Answer by Hellium · Mar 08, 2018 at 02:23 PM
I've never used iTween
, but, as far as I understand, you can provide a function name, called once your tween ends.
public string pathName;
public float time;
// Use this for initialization
void Start () {
FollowPath();
//StartCoroutine (LoopVFX());
}
//Update is called once per frame
void Update () {
// DON'T START A COROUTINE IN THE UPDATE FUNCTION UNLESS YOU UNDERSTAND WHAT COROUTINES ARE,
// IT STARTS A COROUTINE EVERY FRAME
//StartCoroutine (LoopLine ());
}
IEnumerator LoopLine (){
int waitWindTime = 10;
int loopCount = 30;
for (int i = 0; i< loopCount; i++){
yield return new WaitForSeconds (waitWindTime);
}
}
public void FollowPath()
{
iTween.MoveTo( gameObject, iTween.Hash("Path", iTweenPath.GetPath (pathName),"easetype",iTween.EaseType.easeInOutSine, "time", time, "oncomplete", "FollowPath"));
}
You're such a big help thank you so much :'). I'm a senior in Animation and I'm preparing for my graduation show with a fishing game. I will def credit you and send you a youtube link when it's done!! I'll also try to stop asking noob questions haha