• StandardLerp.cs
  • /
  • /
  • /
  • /
1 using UnityEngine;
2 using
System.Collections;
3
4 public
class StandardLerp
5 {
6     
7
8     
public static IEnumerator EaseTranslate(GameObject objectToLerp, Transform destination, float time)
9     {
10         
float elapsedTime = 0;
11
12         
while (elapsedTime < time * 3)
13         {
14             objectToLerp.transform.position = Vector3.Lerp (
15                                                         objectToLerp.transform.position,
16                                                         destination.position,
17                                                         elapsedTime/(
100*time)
18                                                     );
19             elapsedTime += Time.deltaTime;
20
21             
yield return new WaitForEndOfFrame();
22         }
23         objectToLerp.transform.position = destination.position;
24     }
25
26
27 }


Gõ tìm kiếm nhanh...