暂且修了LookAt
This commit is contained in:
@@ -1,58 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Ichni
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 自定义曲线预设
|
||||
/// </summary>
|
||||
public static class CustomCurvePresets
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 瞬间完成
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static AnimationCurve Instant()
|
||||
{
|
||||
Keyframe[] keys = new Keyframe[2];
|
||||
keys[0] = new Keyframe(0, 1, 0, 0);
|
||||
keys[1] = new Keyframe(1, 1, 0, 0);
|
||||
return new AnimationCurve(keys);
|
||||
}
|
||||
|
||||
/// <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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 自定义峰值点位置的抛物线曲线,在指定时间点达到最大值,两端为起始值
|
||||
/// </summary>
|
||||
/// <param name="totalTime">总时间</param>
|
||||
/// <param name="startValue">起始(和结束)值</param>
|
||||
/// <param name="peakValue">最大值</param>
|
||||
/// <param name="peakTimePercent">最大值的比例点</param>
|
||||
/// <returns></returns>
|
||||
public static AnimationCurve CustomPeakTimeParabolic(float totalTime, float startValue, float peakValue, float peakTimePercent)
|
||||
{
|
||||
Keyframe[] keys = new Keyframe[3];
|
||||
keys[0] = new Keyframe(0, startValue, 0, 0);
|
||||
keys[1] = new Keyframe(totalTime * peakTimePercent, peakValue, 0, 0);
|
||||
keys[2] = new Keyframe(totalTime, startValue, 0, 0);
|
||||
return new AnimationCurve(keys);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ac4cc158ed88d48af9a350196b874508
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -24,11 +24,12 @@ namespace Ichni.RhythmGame
|
||||
public Vector3 currentPosition;
|
||||
public Vector3 currentEulerAngles;
|
||||
public Vector3 currentScale;
|
||||
|
||||
|
||||
public bool positionDirtyMark;
|
||||
public bool eulerAnglesDirtyMark;
|
||||
public bool scaleDirtyMark;
|
||||
|
||||
public LookAt lookAt;
|
||||
public bool eulerAnglesOffsetLock;
|
||||
|
||||
public TransformSubmodule(GameElement attachedGameElement) : base(attachedGameElement)
|
||||
@@ -157,55 +158,39 @@ namespace Ichni.RhythmGame
|
||||
|
||||
if (transformSubmodule.scaleDirtyMark)
|
||||
{
|
||||
Vector3 offset = Vector3.zero;
|
||||
foreach (Vector3 scaleOffset in transformSubmodule.scaleOffset)
|
||||
{
|
||||
offset += scaleOffset;
|
||||
}
|
||||
|
||||
Vector3 offset = transformSubmodule.scaleOffset.Sum();
|
||||
transformSubmodule.currentScale = transformSubmodule.originalScale + offset;
|
||||
attachedGameElement.transform.localScale = transformSubmodule.currentScale;
|
||||
transformSubmodule.scaleDirtyMark = false;
|
||||
willRefresh = true;
|
||||
transformSubmodule.scaleOffset.Clear();
|
||||
}
|
||||
|
||||
if (transformSubmodule.eulerAnglesDirtyMark)
|
||||
{
|
||||
Vector3 offset = Vector3.zero;
|
||||
foreach (Vector3 eulerOffset in transformSubmodule.eulerAnglesOffset)
|
||||
{
|
||||
offset += eulerOffset;
|
||||
}
|
||||
|
||||
Vector3 offset = transformSubmodule.eulerAnglesOffset.Sum();
|
||||
transformSubmodule.currentEulerAngles = transformSubmodule.originalEulerAngles + offset;
|
||||
attachedGameElement.transform.localEulerAngles = transformSubmodule.currentEulerAngles;
|
||||
transformSubmodule.eulerAnglesDirtyMark = false;
|
||||
willRefresh = true;
|
||||
transformSubmodule.eulerAnglesOffset.Clear();
|
||||
}
|
||||
|
||||
if (transformSubmodule.positionDirtyMark)
|
||||
{
|
||||
Vector3 offset = Vector3.zero;
|
||||
foreach (Vector3 posOffset in transformSubmodule.positionOffset)
|
||||
{
|
||||
offset += posOffset;
|
||||
}
|
||||
|
||||
Vector3 offset = transformSubmodule.positionOffset.Sum();
|
||||
transformSubmodule.currentPosition = transformSubmodule.originalPosition + offset;
|
||||
attachedGameElement.transform.localPosition = transformSubmodule.currentPosition;
|
||||
transformSubmodule.positionDirtyMark = false;
|
||||
willRefresh = true;
|
||||
transformSubmodule.positionOffset.Clear();
|
||||
}
|
||||
|
||||
if(willRefresh)
|
||||
{
|
||||
attachedGameElement.Refresh();
|
||||
}
|
||||
|
||||
transformSubmodule.scaleOffset.Clear();
|
||||
transformSubmodule.eulerAnglesOffset.Clear();
|
||||
transformSubmodule.positionOffset.Clear();
|
||||
|
||||
|
||||
}).AddTo(attachedGameElement);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@ namespace Ichni.RhythmGame
|
||||
Debug.LogError("Null element detected in elementList. Skipping execution.");
|
||||
return;
|
||||
}
|
||||
Debug.Log(element.GetType());
|
||||
//Debug.Log(element.GetType());
|
||||
if (LowPriorityGameElementTypes.Contains(element.GetType()))
|
||||
{
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user