代码改变世界

NGUI中的Tween Position动画

2017-05-20 12:27  梦随烟去  阅读(1472)  评论(0编辑  收藏  举报

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Inventory : MonoBehaviour {

public static Inventory _instance;
private TweenPosition tween;//获取组件
void Awake() {
_instance = this;
tween = this.GetComponent<TweenPosition>();//获取组件
}
void Update () {

}

//需要播放的UI动画是从UI界面外移到UI界面里
public void Show() {
tween.PlayForward();//播放动画

}
public void Hide() {
tween.PlayReverse();//反向播放动画
}
}