mirror of
https://gitgud.io/AbstractConcept/rimworld-animation-studio.git
synced 2024-08-15 00:43:27 +00:00
Initial commit
This commit is contained in:
commit
3c7cc0c973
8391 changed files with 704313 additions and 0 deletions
|
@ -0,0 +1,73 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace UnityEditor.U2D.Path
|
||||
{
|
||||
public enum TangentMode
|
||||
{
|
||||
Linear = 0,
|
||||
Continuous = 1,
|
||||
Broken = 2
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public struct TangentCache
|
||||
{
|
||||
public Vector3 leftTangent;
|
||||
public Vector3 rightTangent;
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public struct ControlPoint
|
||||
{
|
||||
public Vector3 position;
|
||||
public Vector3 localLeftTangent;
|
||||
public Vector3 localRightTangent;
|
||||
public TangentMode tangentMode;
|
||||
public TangentCache continuousCache;
|
||||
public TangentCache brokenCache;
|
||||
public bool mirrorLeft;
|
||||
|
||||
public Vector3 leftTangent
|
||||
{
|
||||
get { return localLeftTangent + position; }
|
||||
set { localLeftTangent = value - position; }
|
||||
}
|
||||
|
||||
public Vector3 rightTangent
|
||||
{
|
||||
get { return localRightTangent + position; }
|
||||
set { localRightTangent = value - position; }
|
||||
}
|
||||
|
||||
public void StoreTangents()
|
||||
{
|
||||
if (tangentMode == TangentMode.Continuous)
|
||||
{
|
||||
continuousCache.leftTangent = localLeftTangent;
|
||||
continuousCache.rightTangent = localRightTangent;
|
||||
}
|
||||
else if (tangentMode == TangentMode.Broken)
|
||||
{
|
||||
brokenCache.leftTangent = localLeftTangent;
|
||||
brokenCache.rightTangent = localRightTangent;
|
||||
}
|
||||
}
|
||||
|
||||
public void RestoreTangents()
|
||||
{
|
||||
if (tangentMode == TangentMode.Continuous)
|
||||
{
|
||||
localLeftTangent = continuousCache.leftTangent;
|
||||
localRightTangent = continuousCache.rightTangent;
|
||||
}
|
||||
else if (tangentMode == TangentMode.Broken)
|
||||
{
|
||||
localLeftTangent = brokenCache.leftTangent;
|
||||
localRightTangent = brokenCache.rightTangent;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue