|
- using UnityEngine;
- using System.Collections;
- public class Move : MonoBehaviour {
- public float durning;
- public Vector3 toPos;
-
- private Transform t;
- private Vector3 oriPos;
- private float lerp;
-
- // Use this for initialization
- void Start () {
- t = transform;
- oriPos = t.localPosition;
- }
-
- // Update is called once per frame
- void Update () {
- lerp = Mathf.PingPong(Time.time, durning) / durning;
- t.localPosition = Vector3.Lerp(oriPos, toPos, lerp);
- }
- }
复制代码 |
|