tweaks to handling of animation context

This commit is contained in:
Platinum 2020-06-02 13:20:38 -07:00
parent 6ebd521519
commit 4adc4a6906
6 changed files with 301 additions and 287 deletions

View file

@ -38,6 +38,8 @@ namespace Rimworld_Animations {
private bool mirror = false, quiver = false, shiver = false;
private int actor;
private int lastDrawFrame = -1;
private int animTicks = 0, stageTicks = 0, clipTicks = 0;
private int curStage = 0;
private float clipPercent = 0;
@ -259,6 +261,10 @@ namespace Rimworld_Animations {
public void calculateDrawValues() {
if(Find.TickManager.TickRateMultiplier > 1 && (lastDrawFrame + 1 >= RealTime.frameCount || RealTime.deltaTime < 0.05f)) {
return;
}
deltaPos = new Vector3(clip.BodyOffsetX.Evaluate(clipPercent) * (mirror ? -1 : 1), clip.layer.AltitudeFor(), clip.BodyOffsetZ.Evaluate(clipPercent));
if (AnimationSettings.offsets != null && AnimationSettings.offsets.ContainsKey(CurrentAnimation.defName + pawn.def.defName + ActorIndex)) {
@ -307,6 +313,8 @@ namespace Rimworld_Animations {
}
headBob = new Vector3(0, 0, clip.HeadBob.Evaluate(clipPercent));
lastDrawFrame = RealTime.frameCount;
}
public Vector3 getPawnHeadPosition() {