mirror of
https://gitgud.io/AbstractConcept/rimworld-animation-studio.git
synced 2024-08-15 00:43:27 +00:00
44 lines
1.5 KiB
C#
44 lines
1.5 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using UnityEngine;
|
|
|
|
namespace RimWorldAnimationStudio
|
|
{
|
|
public class ActorPosition
|
|
{
|
|
public float bodyOffsetX;
|
|
public float bodyOffsetZ;
|
|
public float bodyAngle;
|
|
public float headBob;
|
|
public float headAngle;
|
|
public float genitalAngle;
|
|
|
|
public int bodyFacing;
|
|
public int headFacing;
|
|
|
|
public ActorPosition(int actorID, int atTick)
|
|
{
|
|
Actor actor = Workspace.GetActor(actorID);
|
|
PawnAnimationClip clip = Workspace.GetPawnAnimationClip(actorID);
|
|
|
|
float clipPercent = atTick / Workspace.StageWindowSize;
|
|
if (atTick > Constants.minTick && atTick == clip.duration) clipPercent = 1f;
|
|
|
|
if (Workspace.GetCurrentAnimationStage().IsLooping == false)
|
|
{ clipPercent = (float)atTick / clip.duration; }
|
|
|
|
bodyOffsetX = clip.BodyOffsetX.Evaluate(clipPercent);
|
|
bodyOffsetZ = clip.BodyOffsetZ.Evaluate(clipPercent);
|
|
bodyAngle = clip.BodyAngle.Evaluate(clipPercent);
|
|
headBob = clip.HeadBob.Evaluate(clipPercent);
|
|
headAngle = clip.HeadAngle.Evaluate(clipPercent);
|
|
genitalAngle = clip.GenitalAngle.Evaluate(clipPercent);
|
|
|
|
bodyFacing = (int)clip.BodyFacing.Evaluate(clipPercent);
|
|
headFacing = (int)clip.HeadFacing.Evaluate(clipPercent);
|
|
}
|
|
}
|
|
}
|