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