public void CheckMovement() { if (HarmonyPatchesFS.AnimatorIsOpen() && MainTabWindow_BaseAnimator.Pawn == this.Pawn) { this._isMoving = true; this._movedPercent = MainTabWindow_BaseAnimator.AnimationPercent; return; } if (this.IsRider) { this._isMoving = false; return; } // pawn started pathing Pawn_PathFollower pather = this.Pawn.pather; if ((pather != null) && (pather.Moving) && !this.Pawn.stances.FullBodyBusy && (pather.BuildingBlockingNextPathCell() == null) && (pather.NextCellDoorToWaitForOrManuallyOpen() == null) && !pather.WillCollideWithPawnOnNextPathCell()) { this._movedPercent = 1f - pather.nextCellCostLeft / pather.nextCellCostTotal; this._isMoving = true; } else { this._isMoving = false; } }
public static void AddFaceEditButton(PanelBackstory __instance, State state) { Rect panelRect = __instance.PanelRect; Pawn pawn = state.CurrentPawn.Pawn; if (!pawn.HasCompFace()) { return; } Rect rect = new Rect(panelRect.width - 90f, 9f, 25f, 25f); GUI.color = rect.Contains(Event.current.mousePosition) ? Color.cyan : new Color(0.623529f, 0.623529f, 0.623529f); GUI.DrawTexture(rect, ContentFinder <Texture2D> .Get("Buttons/ButtonFace")); string tip = "FacialStuffEditor.EditFace".Translate(); TooltipHandler.TipRegion(rect, tip); // ReSharper disable once InvertIf if (Widgets.ButtonInvisible(rect)) { SoundDefOf.TickLow.PlayOneShotOnCamera(); HarmonyPatchesFS.OpenStylingWindow(pawn); } }
private Toil Toils_WaitWithSoundAndEffect() { Toil toil = new Toil { initAction = delegate { CompFaceEditor faceStylerNew = this.TargetA.Thing?.TryGetComp <CompFaceEditor>(); if (faceStylerNew != null) { Pawn actor = this.GetActor(); if (actor != null && actor.Position == this.TargetA.Thing.InteractionCell) { HarmonyPatchesFS.OpenStylingWindow(actor); } } else { Log.Error(ErrorMessage); } }, defaultCompleteMode = ToilCompleteMode.Instant }; return(toil); }
private void DoPoseCycleOffsets(ref Vector3 rightHand, ref List<float> shoulderAngle, ref List<float> handSwingAngle, PoseCycleDef pose) { if (!HarmonyPatchesFS.AnimatorIsOpen()) { return; } SimpleCurve cycleHandsSwingAngle = pose.HandsSwingAngle; SimpleCurve rHandX = pose.HandPositionX; SimpleCurve rHandZ = pose.HandPositionZ; Rot4 rot = this.BodyFacing; // Basic values if pawn is carrying stuff float x = 0; float y = Offsets.YOffset_Behind; float z; float percent = this._animatedPercent; PoseCycleDef poseCycle = this.CompAnimator.PoseCycle; float lookie = rot == Rot4.West ? -1f : 1f; shoulderAngle[1] = lookie * poseCycle?.shoulderAngle ?? 0f; handSwingAngle[1] = (rot == Rot4.West ? -1 : 1) * cycleHandsSwingAngle.Evaluate(percent); x = rHandX.Evaluate(percent) * lookie; z = rHandZ.Evaluate(percent); rightHand += new Vector3(x, 0, z); }
public override void DrawFeet(Quaternion bodyQuat, Quaternion footQuat, Vector3 rootLoc, bool portrait, float factor = 1f) { if (portrait && !HarmonyPatchesFS.AnimatorIsOpen()) { return; } if (this.Pawn.kindDef.lifeStages.Any()) { Vector2 maxSize = this.Pawn.kindDef.lifeStages.Last().bodyGraphicData.drawSize; Vector2 sizePaws = this.Pawn.ageTracker.CurKindLifeStage.bodyGraphicData.drawSize; factor = sizePaws.x / maxSize.x; } // Fix the position, maybe needs new code in GetJointPositions()? if (!this.BodyFacing.IsHorizontal) { // rootLoc.y -= Offsets.YOffset_Behind; } rootLoc.y += this.BodyFacing == Rot4.South ? -Offsets.YOffset_HandsFeetOver : 0; var frontPawLoc = rootLoc; var rearPawLoc = rootLoc; if (!this.BodyFacing.IsHorizontal) { frontPawLoc.y += (this.BodyFacing == Rot4.North ? Offsets.YOffset_Behind : -Offsets.YOffset_Behind); } this.DrawFrontPaws(bodyQuat, footQuat, frontPawLoc, portrait, factor); base.DrawFeet(bodyQuat, footQuat, rearPawLoc, portrait, factor); }
// Verse.PawnTweener public bool IsPosing(out float movedPercent) { movedPercent = 0f; if (HarmonyPatchesFS.AnimatorIsOpen()) { movedPercent = MainTabWindow_BaseAnimator.AnimationPercent; return(true); } return(false); }
public override void BaseHeadOffsetAt(ref Vector3 offset, bool portrait, Pawn pawn1) { Pawn pawn = this.Pawn; Vector2 headOffset = pawn.story.bodyType.headOffset; float horHeadOffset = headOffset.x; float verHeadOffset = headOffset.y; CompBodyAnimator animator = this.CompAnimator; if (animator != null && HarmonyPatchesFS.AnimatorIsOpen()) { horHeadOffset += MainTabWindow_WalkAnimator.HorHeadOffset; verHeadOffset += MainTabWindow_WalkAnimator.VerHeadOffset; } switch (this.BodyFacing.AsInt) { case 0: offset = new Vector3(0f, 0f, verHeadOffset); break; case 1: offset = new Vector3(horHeadOffset, 0f, verHeadOffset); break; case 2: offset = new Vector3(0f, 0f, verHeadOffset); break; case 3: offset = new Vector3(-horHeadOffset, 0f, verHeadOffset); break; default: Log.Error("BaseHeadOffsetAt error in " + pawn); offset = Vector3.zero; return; } if (!portrait) { CompBodyAnimator bodyAnimator = this.CompAnimator; if (bodyAnimator != null && bodyAnimator.IsMoving) { // Let's try a slightly stiffy head CompBodyAnimator compAnimator = this.CompAnimator; if (compAnimator != null) { offset.z -= 0.25f * compAnimator.BodyOffsetZ; } } } }
public override Quaternion QuatHead(Rot4 rotation) { CompBodyAnimator animator = this.CompAnimator; Quaternion asQuat = rotation.AsQuat; if (animator != null) { float headRotatorCurrentMovement; if ((animator.IsMoving || HarmonyPatchesFS.AnimatorIsOpen()) && rotation.IsHorizontal) { headRotatorCurrentMovement = animator.HeadAngleX; } else { headRotatorCurrentMovement = this.CompFace.HeadRotator.CurrentMovement; } float num = 1f; float x = 1f * Mathf.Sin(num * (headRotatorCurrentMovement * 0.1f) % (2 * Mathf.PI)); float z = 1f * Mathf.Cos(num * (headRotatorCurrentMovement * 0.1f) % (2 * Mathf.PI)); asQuat.SetLookRotation(new Vector3(x, 0f, z), Vector3.up); } return(asQuat); // remove the body rotation if (animator != null && (animator.IsMoving && Controller.settings.UseFeet)) { WalkCycleDef walkCycle = this.CompAnimator?.WalkCycle; if (this.BodyFacing.IsHorizontal) { asQuat *= Quaternion.AngleAxis( (this.BodyFacing == Rot4.West ? 1 : -1) * walkCycle?.BodyAngle.Evaluate(this.CompAnimator.MovedPercent) ?? 0f, Vector3.up); } else { asQuat *= Quaternion.AngleAxis( (this.BodyFacing == Rot4.South ? 1 : -1) * walkCycle?.BodyAngleVertical .Evaluate(this.CompAnimator.MovedPercent) ?? 0f, Vector3.up); } } return(asQuat); }
public override void PostDraw() { base.PostDraw(); // Children & Pregnancy || Werewolves transformed if (this.Pawn.Map == null || !this.Pawn.Spawned || this.Pawn.Dead) { return; } if (Find.TickManager.Paused) { if (!HarmonyPatchesFS.AnimatorIsOpen() || MainTabWindow_BaseAnimator.Pawn != this.Pawn) { return; } } if (this.Props.bipedWithHands) { this.BodyAnimator.AnimatorTick(); } // Tweener Vector3Tween eqTween = this.Vector3Tweens[(int)HarmonyPatchesFS.equipment]; FloatTween angleTween = this.AimAngleTween; Vector3Tween leftHand = this.Vector3Tweens[(int)TweenThing.HandLeft]; Vector3Tween rightHand = this.Vector3Tweens[(int)TweenThing.HandRight]; if (leftHand.State == TweenState.Running) { leftHand.Update(1f * Find.TickManager.TickRateMultiplier); } if (rightHand.State == TweenState.Running) { rightHand.Update(1f * Find.TickManager.TickRateMultiplier); } if (eqTween.State == TweenState.Running) { eqTween.Update(1f * Find.TickManager.TickRateMultiplier); } if (angleTween.State == TweenState.Running) { this.AimAngleTween.Update(3f * Find.TickManager.TickRateMultiplier); } this.CheckMovement(); }
public Material HairCutMatAt(Rot4 facing) { if (this.HairCutGraphic == null) { HarmonyPatchesFS.ResolveApparelGraphics_Postfix(this.Pawn.Drawer.renderer.graphics); } Material material = this.HairCutGraphic?.MatAt(facing); if (material != null) { material = this.Pawn.Drawer.renderer.graphics.flasher.GetDamagedMat(material); } return(material); }
public override void DrawFeet(Quaternion bodyQuat, Quaternion footQuat, Vector3 rootLoc, bool portrait) { if (portrait && !HarmonyPatchesFS.AnimatorIsOpen()) { return; } // Fix the position, maybe needs new code in GetJointPositions()? if (!this.BodyFacing.IsHorizontal) { // rootLoc.y -= Offsets.YOffset_Behind; } rootLoc.y += this.BodyFacing == Rot4.South ? -Offsets.YOffset_HandsFeetOver : 0; this.DrawFrontPaws(bodyQuat, footQuat, rootLoc, portrait); // rootLoc.y += this.BodyFacing == Rot4.North ? Offsets.YOffset_Behind : -Offsets.YOffset_Behind; base.DrawFeet(bodyQuat, footQuat, rootLoc, portrait); }
public override void Tick(Rot4 bodyFacing, PawnGraphicSet graphics) { base.Tick(bodyFacing, graphics); BodyAnimator animator = this.CompAnimator.BodyAnimator; if (animator != null) { animator.IsPosing(out this._animatedPercent); } // var curve = bodyFacing.IsHorizontal ? this.walkCycle.BodyOffsetZ : this.walkCycle.BodyOffsetVerticalZ; bool pawnInEditor = HarmonyPatchesFS.AnimatorIsOpen() && MainTabWindow_BaseAnimator.Pawn == this.Pawn; if (!Find.TickManager.Paused || pawnInEditor) { this.SelectWalkcycle(pawnInEditor); this.SelectPosecycle(); this.CompAnimator.FirstHandPosition = Vector3.zero; this.CompAnimator.SecondHandPosition = Vector3.zero; } }
public virtual void SelectPosecycle() { return; if (HarmonyPatchesFS.AnimatorIsOpen()) { // this.CompAnimator.PoseCycle = MainTabWindow_PoseAnimator.EditorPoseCycle; } if (this.Pawn.CurJob != null) { BodyAnimDef animDef = this.CompAnimator.BodyAnim; List<PoseCycleDef> cycles = animDef?.poseCycles; if (cycles != null && cycles.Count > 0) { this.CompAnimator.PoseCycle = animDef.poseCycles.FirstOrDefault(); } // switch (this.Pawn.CurJob.locomotionUrgency) // { // case LocomotionUrgency.None: // case LocomotionUrgency.Amble: // this.walkCycle = WalkCycleDefOf.Biped_Amble; // break; // case LocomotionUrgency.Walk: // this.walkCycle = WalkCycleDefOf.Biped_Walk; // break; // case LocomotionUrgency.Jog: // this.walkCycle = WalkCycleDefOf.Biped_Jog; // break; // case LocomotionUrgency.Sprint: // this.walkCycle = WalkCycleDefOf.Biped_Sprint; // break; // } } }
public override void DrawHands(Quaternion bodyQuat, Vector3 drawPos, bool portrait, Thing carriedThing = null, bool flip = false) { if (this.Pawn.Dead || this.Pawn.Downed) { return; } if (portrait && !HarmonyPatchesFS.AnimatorIsOpen()) { return; } if (!this.CompAnimator.Props.bipedWithHands) { return; } // return if hands already drawn on carrything bool carrying = carriedThing != null; if (this.CarryStuff() && !carrying) { return; } if (carrying) { this.ApplyEquipmentWobble(ref drawPos); carriedThing.DrawAt(drawPos, flip); } BodyAnimDef body = this.CompAnimator.BodyAnim; Rot4 rot = this.BodyFacing; if (body == null) { return; } JointLister shoulperPos = this.GetJointPositions(JointType.Shoulder, body.shoulderOffsets[rot.AsInt], body.shoulderOffsets[Rot4.North.AsInt].x, carrying, this.Pawn.ShowWeaponOpenly()); List <float> handSwingAngle = new List <float> { 0f, 0f }; List <float> shoulderAngle = new List <float> { 0f, 0f }; Vector3 rightHand = Vector3.zero; Vector3 leftHand = Vector3.zero; WalkCycleDef walkCycle = this.CompAnimator.WalkCycle; PoseCycleDef poseCycle = this.CompAnimator.PoseCycle; if (walkCycle != null) { float offsetJoint = walkCycle.ShoulderOffsetHorizontalX.Evaluate(this.CompAnimator.MovedPercent); this.DoWalkCycleOffsets( body.armLength, ref rightHand, ref leftHand, ref shoulderAngle, ref handSwingAngle, ref shoulperPos, carrying, walkCycle.HandsSwingAngle, offsetJoint); } if (poseCycle != null) { this.DoPoseCycleOffsets(ref rightHand, ref shoulderAngle, ref handSwingAngle, poseCycle); } this.DoAttackAnimationHandOffsets(ref handSwingAngle, ref rightHand, false); this.GetBipedMesh(out Mesh handMeshRight, out Mesh handMeshLeft); Material matLeft = this.LeftHandMat; Material matRight = this.RightHandMat; if (MainTabWindow_BaseAnimator.Colored) { matLeft = this.CompAnimator.PawnBodyGraphic?.HandGraphicLeftCol?.MatSingle; matRight = this.CompAnimator.PawnBodyGraphic?.HandGraphicRightCol?.MatSingle; } else if (carriedThing == null) { switch (rot.AsInt) { case 1: matLeft = this.LeftHandShadowMat; break; case 3: matRight = this.RightHandShadowMat; break; } } bool drawLeft = matLeft != null && this.CompAnimator.BodyStat.HandLeft != PartStatus.Missing; bool drawRight = matRight != null && this.CompAnimator.BodyStat.HandRight != PartStatus.Missing; if (drawLeft) { Quaternion quat; Vector3 position; bool noTween = false; if (!this.CompAnimator.IsMoving && this.CompAnimator.HasLeftHandPosition) { position = this.CompAnimator.SecondHandPosition; quat = this.CompAnimator.WeaponQuat; noTween = true; } else { shoulperPos.LeftJoint = bodyQuat * shoulperPos.LeftJoint; leftHand = bodyQuat * leftHand.RotatedBy(-handSwingAngle[0] - shoulderAngle[0]); position = drawPos + shoulperPos.LeftJoint + leftHand; quat = bodyQuat * Quaternion.AngleAxis(-handSwingAngle[0], Vector3.up); } TweenThing handLeft = TweenThing.HandLeft; this.DrawTweenedHand(position, handMeshLeft, matLeft, quat, handLeft, portrait, noTween); //GenDraw.DrawMeshNowOrLater( // handMeshLeft, position, // quat, // matLeft, // portrait); } if (drawRight) { Quaternion quat; Vector3 position; bool noTween = false; if (this.CompAnimator.FirstHandPosition != Vector3.zero) { quat = this.CompAnimator.WeaponQuat; position = this.CompAnimator.FirstHandPosition; noTween = true; } else { shoulperPos.RightJoint = bodyQuat * shoulperPos.RightJoint; rightHand = bodyQuat * rightHand.RotatedBy(handSwingAngle[1] - shoulderAngle[1]); position = drawPos + shoulperPos.RightJoint + rightHand; quat = bodyQuat * Quaternion.AngleAxis(handSwingAngle[1], Vector3.up); } TweenThing handRight = TweenThing.HandRight; this.DrawTweenedHand(position, handMeshRight, matRight, quat, handRight, portrait, noTween); // GenDraw.DrawMeshNowOrLater( // handMeshRight, position, // quat, // matRight, // portrait); } if (MainTabWindow_BaseAnimator.Develop) { // for debug Material centerMat = GraphicDatabase.Get <Graphic_Single>( "Hands/Human_Hand_dev", ShaderDatabase.CutoutSkin, Vector2.one, Color.white).MatSingle; GenDraw.DrawMeshNowOrLater( handMeshLeft, drawPos + shoulperPos.LeftJoint + new Vector3(0, -0.301f, 0), bodyQuat * Quaternion.AngleAxis(-shoulderAngle[0], Vector3.up), centerMat, portrait); GenDraw.DrawMeshNowOrLater( handMeshRight, drawPos + shoulperPos.RightJoint + new Vector3(0, 0.301f, 0), bodyQuat * Quaternion.AngleAxis(-shoulderAngle[1], Vector3.up), centerMat, portrait); } }
public override void DrawFeet(Quaternion bodyQuat, Quaternion footQuat, Vector3 rootLoc, bool portrait) { if (this.Pawn.Dead || this.Pawn.Downed) { return; } /// No feet while sitting at a table Job curJob = this.Pawn.CurJob; if (curJob != null) { if (curJob.def == JobDefOf.Ingest && !this.Pawn.Rotation.IsHorizontal) { if (curJob.targetB.IsValid) { for (int i = 0; i < 4; i++) { Rot4 rotty = new Rot4(i); IntVec3 intVec = this.Pawn.Position + rotty.FacingCell; if (intVec == curJob.targetB) { return; } } } } } if (portrait && !HarmonyPatchesFS.AnimatorIsOpen()) { return; } Quaternion drawQuat = this.CompAnimator.IsMoving ? footQuat : bodyQuat; Rot4 rot = this.BodyFacing; // Basic values BodyAnimDef body = this.CompAnimator.BodyAnim; if (body == null) { return; } JointLister groundPos = this.GetJointPositions(JointType.Hip, body.hipOffsets[rot.AsInt], body.hipOffsets[Rot4.North.AsInt].x); Vector3 rightFootCycle = Vector3.zero; Vector3 leftFootCycle = Vector3.zero; float footAngleRight = 0; float footAngleLeft = 0; float offsetJoint = 0; WalkCycleDef cycle = this.CompAnimator.WalkCycle; if (cycle != null) { offsetJoint = cycle.HipOffsetHorizontalX.Evaluate(this.CompAnimator.MovedPercent); this.DoWalkCycleOffsets( ref rightFootCycle, ref leftFootCycle, ref footAngleRight, ref footAngleLeft, ref offsetJoint, cycle.FootPositionX, cycle.FootPositionZ, cycle.FootAngle); } this.GetBipedMesh(out Mesh footMeshRight, out Mesh footMeshLeft); Material matRight; Material matLeft; if (MainTabWindow_BaseAnimator.Colored) { matRight = this.CompAnimator.PawnBodyGraphic?.FootGraphicRightCol?.MatAt(rot); matLeft = this.CompAnimator.PawnBodyGraphic?.FootGraphicLeftCol?.MatAt(rot); } else { Material rightFoot = this.CompAnimator.PawnBodyGraphic?.FootGraphicRight?.MatAt(rot); Material leftFoot = this.CompAnimator.PawnBodyGraphic?.FootGraphicLeft?.MatAt(rot); Material leftShadow = this.CompAnimator.PawnBodyGraphic?.FootGraphicLeftShadow?.MatAt(rot); Material rightShadow = this.CompAnimator.PawnBodyGraphic?.FootGraphicRightShadow?.MatAt(rot); switch (rot.AsInt) { default: matRight = this.Flasher.GetDamagedMat(rightFoot); matLeft = this.Flasher.GetDamagedMat(leftFoot); break; case 1: matRight = this.Flasher.GetDamagedMat(rightFoot); matLeft = this.Flasher.GetDamagedMat(leftShadow); break; case 3: matRight = this.Flasher.GetDamagedMat(rightShadow); matLeft = this.Flasher.GetDamagedMat(leftFoot); break; } } bool drawRight = matRight != null && this.CompAnimator.BodyStat.FootRight != PartStatus.Missing; bool drawLeft = matLeft != null && this.CompAnimator.BodyStat.FootLeft != PartStatus.Missing; groundPos.LeftJoint = drawQuat * groundPos.LeftJoint; groundPos.RightJoint = drawQuat * groundPos.RightJoint; leftFootCycle = drawQuat * leftFootCycle; rightFootCycle = drawQuat * rightFootCycle; Vector3 ground = rootLoc + drawQuat * new Vector3(0, 0, OffsetGroundZ); if (drawLeft) { // TweenThing leftFoot = TweenThing.FootLeft; // PawnPartsTweener tweener = this.CompAnimator.PartTweener; // if (tweener != null) { Vector3 position = ground + groundPos.LeftJoint + leftFootCycle; // tweener.PartPositions[(int)leftFoot] = position; // tweener.PreThingPosCalculation(leftFoot, spring: SpringTightness.Stff); GenDraw.DrawMeshNowOrLater( footMeshLeft, position, // tweener.TweenedPartsPos[(int)leftFoot], drawQuat * Quaternion.AngleAxis(footAngleLeft, Vector3.up), matLeft, portrait); } } if (drawRight) { // TweenThing rightFoot = TweenThing.FootRight; // PawnPartsTweener tweener = this.CompAnimator.PartTweener; // if (tweener != null) // { Vector3 position = ground + groundPos.RightJoint + rightFootCycle; // tweener.PartPositions[(int)rightFoot] = position; // tweener.PreThingPosCalculation(rightFoot, spring: SpringTightness.Stff); GenDraw.DrawMeshNowOrLater( footMeshRight, position, // tweener.TweenedPartsPos[(int)rightFoot], drawQuat * Quaternion.AngleAxis(footAngleRight, Vector3.up), matRight, portrait); // } } if (MainTabWindow_BaseAnimator.Develop) { // for debug Material centerMat = GraphicDatabase .Get <Graphic_Single>("Hands/Ground", ShaderDatabase.Transparent, Vector2.one, Color.red).MatSingle; GenDraw.DrawMeshNowOrLater( footMeshLeft, ground + groundPos.LeftJoint + new Vector3(offsetJoint, -0.301f, 0), drawQuat * Quaternion.AngleAxis(0, Vector3.up), centerMat, portrait); GenDraw.DrawMeshNowOrLater( footMeshRight, ground + groundPos.RightJoint + new Vector3(offsetJoint, 0.301f, 0), drawQuat * Quaternion.AngleAxis(0, Vector3.up), centerMat, portrait); Material hipMat = GraphicDatabase .Get <Graphic_Single>("Hands/Human_Hand_dev", ShaderDatabase.Transparent, Vector2.one, Color.blue).MatSingle; GenDraw.DrawMeshNowOrLater( footMeshLeft, groundPos.LeftJoint + new Vector3(offsetJoint, -0.301f, 0), drawQuat * Quaternion.AngleAxis(0, Vector3.up), centerMat, portrait); // UnityEngine.Graphics.DrawMesh(handsMesh, center + new Vector3(0, 0.301f, z), // Quaternion.AngleAxis(0, Vector3.up), centerMat, 0); // UnityEngine.Graphics.DrawMesh(handsMesh, center + new Vector3(0, 0.301f, z2), // Quaternion.AngleAxis(0, Vector3.up), centerMat, 0); } }
private void DrawTweenedHand(Vector3 position, Mesh handsMesh, Material material, Quaternion quat, TweenThing tweenThing, bool portrait, bool noTween) { if (position == Vector3.zero || handsMesh == null || material == null || quat == null || tweenThing == null) { return; } if (!this.Pawn.Downed || !this.Pawn.Dead) { if (!HarmonyPatchesFS.AnimatorIsOpen() && Find.TickManager.TicksGame == this.CompAnimator.LastPosUpdate[(int)tweenThing] || HarmonyPatchesFS.AnimatorIsOpen() && MainTabWindow_BaseAnimator.Pawn != this.Pawn) { position = this.CompAnimator.LastPosition[(int)tweenThing]; } else { if (this.Pawn.pather.MovedRecently(5)) { noTween = true; } this.CompAnimator.LastPosUpdate[(int)tweenThing] = Find.TickManager.TicksGame; Vector3Tween tween = this.CompAnimator.Vector3Tweens[(int)tweenThing]; switch (tween.State) { case TweenState.Running: if (noTween || this.CompAnimator.IsMoving) { tween.Stop(StopBehavior.ForceComplete); } position = tween.CurrentValue; break; case TweenState.Paused: break; case TweenState.Stopped: if (noTween || (this.CompAnimator.IsMoving)) { break; } ScaleFunc scaleFunc = ScaleFuncs.SineEaseOut; Vector3 start = this.CompAnimator.LastPosition[(int)tweenThing]; float distance = Vector3.Distance(start, position); float duration = Mathf.Abs(distance * 50f); if (start != Vector3.zero && duration > 12f) { start.y = position.y; tween.Start(start, position, duration, scaleFunc); position = start; } break; } this.CompAnimator.LastPosition[(int)tweenThing] = position; } } // tweener.PreThingPosCalculation(tweenThing, noTween); GenDraw.DrawMeshNowOrLater( handsMesh, position, quat, material, portrait); }