mirror of
https://gitgud.io/c0ffeeeeeeee/rimworld-animations.git
synced 2024-08-15 00:43:45 +00:00
Added age range body offsets
This commit is contained in:
parent
776c18a715
commit
781e4321dd
4 changed files with 46 additions and 0 deletions
Binary file not shown.
|
@ -24,6 +24,17 @@
|
|||
<li><bodyType>Hulk</bodyType><offset>(0, 0, 0.223)</offset></li>
|
||||
</offsets>
|
||||
</li>
|
||||
<!-- An example of age-ranged offsets
|
||||
<li Class="Rimworld_Animations.AnimationOffset_AgeRange" MayRequire="Mod.ID.Here">
|
||||
<races>
|
||||
<li>Moosesian</li>
|
||||
</races>
|
||||
<offsetsFemale>
|
||||
<li><bodyType>Female</bodyType><ageRange>18~24</ageRange><offset>(0, 0, 0.223)</offset></li>
|
||||
<li><bodyType>Female</bodyType><ageRange>25~100</ageRange><offset>(0, 0, 0.4)</offset></li>
|
||||
</offsetsFemale>
|
||||
</li>
|
||||
-->
|
||||
</offsets>
|
||||
</Rimworld_Animations.AnimationOffsetDef>
|
||||
</Defs>
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
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 AnimationOffset_AgeRange : BaseAnimationOffset
|
||||
{
|
||||
public List<BodyTypeOffset_AgeRange> offsetsMale;
|
||||
public List<BodyTypeOffset_AgeRange> offsetsFemale;
|
||||
|
||||
public override Vector3? getOffset(Pawn pawn)
|
||||
{
|
||||
List<BodyTypeOffset_AgeRange> pawnOffsets = (pawn.gender == Gender.Male ? offsetsMale : offsetsFemale);
|
||||
return pawnOffsets.Find(x => x.bodyType == pawn.story.bodyType && x.ageRange.Includes(pawn.ageTracker.AgeBiologicalYears))?.offset ?? pawnOffsets.Last().offset;
|
||||
}
|
||||
|
||||
public override int? getRotation(Pawn pawn)
|
||||
{
|
||||
List<BodyTypeOffset_AgeRange> pawnOffsets = (pawn.gender == Gender.Male ? offsetsMale : offsetsFemale);
|
||||
return pawnOffsets.Find(x => x.bodyType == pawn.story.bodyType && x.ageRange.Includes(pawn.ageTracker.AgeBiologicalYears))?.rotation ?? pawnOffsets.Last().rotation;
|
||||
}
|
||||
}
|
||||
|
||||
public class BodyTypeOffset_AgeRange : BodyTypeOffset
|
||||
{
|
||||
public FloatRange ageRange;
|
||||
|
||||
}
|
||||
}
|
|
@ -77,6 +77,7 @@
|
|||
<Compile Include="1.5\Source\Actors\Actor.cs" />
|
||||
<Compile Include="1.5\Source\Actors\AlienRaceOffset.cs" />
|
||||
<Compile Include="1.5\Source\Animations\AnimationOffsets\AnimationOffsetDef.cs" />
|
||||
<Compile Include="1.5\Source\Animations\AnimationOffsets\Offsets\AnimationOffset_AgeRange.cs" />
|
||||
<Compile Include="1.5\Source\Animations\AnimationOffsets\Offsets\AnimationOffset_BodyType.cs" />
|
||||
<Compile Include="1.5\Source\Animations\AnimationOffsets\Offsets\AnimationOffset_BodyTypeGendered.cs" />
|
||||
<Compile Include="1.5\Source\Animations\AnimationOffsets\Offsets\AnimationOffset_Single.cs" />
|
||||
|
|
Loading…
Reference in a new issue