2024-04-22 01:49:24 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
using Verse;
|
|
|
|
|
|
|
|
|
|
namespace Rimworld_Animations
|
|
|
|
|
{
|
|
|
|
|
public class PawnRenderSubWorker_ChangeOffset : PawnRenderSubWorker
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
public override void TransformOffset(PawnRenderNode node, PawnDrawParms parms, ref Vector3 offset, ref Vector3 pivot)
|
|
|
|
|
{
|
|
|
|
|
if (node.AnimationWorker is AnimationWorker_KeyframesExtended
|
|
|
|
|
&& node.tree.pawn.TryGetComp<CompExtendedAnimator>(out CompExtendedAnimator extendedAnimator)
|
|
|
|
|
&& extendedAnimator.IsAnimating)
|
|
|
|
|
{
|
|
|
|
|
Vector3? pawnOffset = extendedAnimator.Offset;
|
|
|
|
|
if (pawnOffset != null)
|
|
|
|
|
{
|
|
|
|
|
offset += (Vector3)pawnOffset;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-04-23 20:53:13 +00:00
|
|
|
|
|
|
|
|
|
public override void TransformRotation(PawnRenderNode node, PawnDrawParms parms, ref Quaternion rotation)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
if (node.AnimationWorker is AnimationWorker_KeyframesExtended
|
|
|
|
|
&& node.tree.pawn.TryGetComp<CompExtendedAnimator>(out CompExtendedAnimator extendedAnimator)
|
|
|
|
|
&& extendedAnimator.IsAnimating)
|
|
|
|
|
{
|
|
|
|
|
int? pawnRotation = extendedAnimator.Rotation;
|
|
|
|
|
if (pawnRotation != null)
|
|
|
|
|
{
|
|
|
|
|
Quaternion additionalRotation = Quaternion.AngleAxis((int)pawnRotation, Vector3.up);
|
|
|
|
|
rotation *= additionalRotation;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
base.TransformRotation(node, parms, ref rotation);
|
|
|
|
|
}
|
|
|
|
|
|
2024-04-22 01:49:24 +00:00
|
|
|
|
}
|
|
|
|
|
}
|