Unity AnimationCurve


unityAnimationCurv曲線變量很好的為我們提供了一個極其方便的數學曲線工具,比如刷怪的時間間隔隨着時間的增長,呈現一個多樣性的變化,而AnimationCurve便很好的做到了這一點

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

public class NewBehaviourScript : MonoBehaviour
{
    public AnimationCurve animCurve;
    public float timer = 0;

    // Update is called once per frame
    void Update()
    {
        timer += Time.deltaTime;
        float y = animCurve.Evaluate(timer);
        transform.position = new Vector3(0, y, 0);
    }
}

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM