Created
February 21, 2014 00:02
-
-
Save teitei-tk/9126075 to your computer and use it in GitHub Desktop.
NGUI TweenPosition Example x 座標0 or 350にDURATION分の時間を使いながら移動。
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; | |
public class TweenPositionTest : MonoBehaviour | |
{ | |
private GameObject tweenTarget; | |
public const float DURATION = 0.1f; | |
public void Start() | |
{ | |
this.tweenTarget = GameObject.Find("TweenTarget"); | |
} | |
public void onClick() | |
{ | |
Vector3 movePosition = new Vector3(0, 0, 0); | |
TweenPosition twPosition = TweenPosition.Begin( this.tweenTarget, TweenPositionTest.DURATION, movePosition ); | |
twPosition.onFinished += callback; | |
} | |
public void onFinishClick() | |
{ | |
Vector3 movePosition = new Vector3(350.0F, 0, 0); | |
TweenPosition twPosition = TweenPosition.Begin( this.tweenTarget, TweenPositionTest.DURATION, movePosition ); | |
twPosition.onFinished += callback; | |
} | |
private void callback(UITweener tween) | |
{ | |
Debug.Log("run finished callback"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment