狗屎Minimax坏我代码
This commit is contained in:
@@ -17,26 +17,65 @@ namespace SLSUtilities.General
|
||||
return new Vector3(vector.x, 0, vector.z);
|
||||
}
|
||||
}
|
||||
|
||||
public class LerpFloat
|
||||
|
||||
public abstract class LerpValue<T>
|
||||
{
|
||||
public T currentValue;
|
||||
public T targetValue;
|
||||
public bool IsPausing { get; set; }
|
||||
|
||||
public bool advancedSettings = false;
|
||||
|
||||
public abstract void Update(float deltaTime);
|
||||
|
||||
public abstract void Update(float customSpeed, float deltaTime);
|
||||
}
|
||||
|
||||
public class LerpFloat : LerpValue<float>
|
||||
{
|
||||
public float currentValue;
|
||||
public float targetValue;
|
||||
public float lerpSpeed;
|
||||
public float increaseSpeed;
|
||||
public float decreaseSpeed;
|
||||
|
||||
public LerpFloat(float initialValue, float lerpSpeed)
|
||||
{
|
||||
this.currentValue = initialValue;
|
||||
this.targetValue = initialValue;
|
||||
this.advancedSettings = false;
|
||||
this.lerpSpeed = lerpSpeed;
|
||||
}
|
||||
|
||||
public void Update(float deltaTime)
|
||||
|
||||
public LerpFloat(float initialValue, float increaseSpeed, float decreaseSpeed)
|
||||
{
|
||||
currentValue = Mathf.Lerp(currentValue, targetValue, lerpSpeed * deltaTime);
|
||||
this.currentValue = initialValue;
|
||||
this.targetValue = initialValue;
|
||||
this.advancedSettings = true;
|
||||
this.increaseSpeed = increaseSpeed;
|
||||
this.decreaseSpeed = decreaseSpeed;
|
||||
}
|
||||
|
||||
public override void Update(float deltaTime)
|
||||
{
|
||||
if (IsPausing) return;
|
||||
|
||||
if (advancedSettings)
|
||||
{
|
||||
if(targetValue > currentValue)
|
||||
{
|
||||
currentValue = Mathf.Lerp(currentValue, targetValue, increaseSpeed * deltaTime);
|
||||
}
|
||||
else
|
||||
{
|
||||
currentValue = Mathf.Lerp(currentValue, targetValue, decreaseSpeed * deltaTime);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
currentValue = Mathf.Lerp(currentValue, targetValue, lerpSpeed * deltaTime);
|
||||
}
|
||||
}
|
||||
|
||||
public void Update(float customSpeed, float deltaTime)
|
||||
public override void Update(float customSpeed, float deltaTime)
|
||||
{
|
||||
currentValue = Mathf.Lerp(currentValue, targetValue, customSpeed * deltaTime);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user