特效自定义曲线

This commit is contained in:
SoulliesOfficial
2025-03-14 22:14:25 -04:00
parent ac2259e813
commit 400bb39058
8 changed files with 266 additions and 39 deletions

View File

@@ -0,0 +1,28 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Ichni
{
/// <summary>
/// 自定义曲线预设
/// </summary>
public static class CustomCurvePresets
{
/// <summary>
/// 抛物线曲线,在中间达到最大值,两端为起始值
/// </summary>
/// <param name="totalTime">总时间</param>
/// <param name="startValue">起始(和结束)值</param>
/// <param name="peakValue">中点最大值</param>
public static AnimationCurve Parabolic(float totalTime, float startValue, float peakValue)
{
Keyframe[] keys = new Keyframe[3];
keys[0] = new Keyframe(0, startValue, 0, 0);
keys[1] = new Keyframe(totalTime / 2, peakValue, 0, 0);
keys[2] = new Keyframe(totalTime, startValue, 0, 0);
return new AnimationCurve(keys);
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: ac4cc158ed88d48af9a350196b874508
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: