- Home /
Switching Between (many) different iTween Paths (C#)
I have a few different iTween paths attached to a Camera
as it is moving, I want to be able to mouseUp on an object to jump on to a new path at that point.
I want to be able to do this a few times...
I have been using js but people are recommending I learn C# so this is what I am trying now:
Here is my Logic so far
Camera Script:
public class iTweenPathCamera : MonoBehaviour {
void Start () {
}
void Update () {
}
//first path
public void Path_1()
{
iTween.MoveTo(gameObject, iTween.Hash ("path", iTweenPath.GetPath("New Path 1"), "time", 12, "easetype", iTween.EaseType.easeInOutSine));
}
//second path
public void Path_2()
{
iTween.MoveTo(gameObject, iTween.Hash ("path", iTweenPath.GetPath("New Path 2"), "time", 12, "easetype", iTween.EaseType.easeInOutSine));
}
}
I have a mouseUp Script (thanks to Robertbu) on different objects triggering Path_1, 2, 3... respectively :
enter code hereusing UnityEngine;
using System.Collections;
public class iTweenMouseUp : MonoBehaviour {
void Start () {
}
void Update () {
}
void OnMouseUp()
{
Camera.main.GetComponent<iTweenPathCamera>().Path_2();
}
}
Thanks in Advance ~be
Comment