1 using Microsoft.Xna.Framework;
2 using System.Collections.Generic;
14 return Check(character) ? GetAnimParams<FishWalkParams>(character,
AnimationType.Walk, file, throwErrors) :
null;
19 public override void StoreSnapshot() => StoreSnapshot<FishWalkParams>();
30 return Check(character) ? GetAnimParams<FishRunParams>(character,
AnimationType.Run, file, throwErrors) :
null;
43 return GetAnimParams<FishSwimFastParams>(character,
AnimationType.SwimFast, file, throwErrors);
46 public override void StoreSnapshot() => StoreSnapshot<FishSwimFastParams>();
54 return GetAnimParams<FishSwimSlowParams>(character,
AnimationType.SwimSlow, file, throwErrors);
57 public override void StoreSnapshot() => StoreSnapshot<FishSwimSlowParams>();
66 DebugConsole.ThrowError($
"{character.SpeciesName} cannot use run animations!",
73 [
Editable,
Serialize(
true,
IsPropertySaveable.Yes, description:
"Should the character be flipped depending on which direction it faces. Should usually be enabled on all characters that have distinctive upper and lower sides.")]
74 public bool Flip {
get;
set; }
79 [
Serialize(0.5f,
IsPropertySaveable.Yes, description:
"How much it takes before the character flips. The timer starts when the character starts to move in the different direction."),
Editable]
82 [
Serialize(10.0f,
IsPropertySaveable.Yes, description:
"How much force is used to move the head to the correct position."),
Editable(MinValueFloat = 0, MaxValueFloat = 100)]
85 [
Serialize(10.0f,
IsPropertySaveable.Yes, description:
"How much force is used to move the torso to the correct position."),
Editable(MinValueFloat = 0, MaxValueFloat = 100)]
88 [
Serialize(8.0f,
IsPropertySaveable.Yes, description:
"How much force is used to move the feet to the correct position."),
Editable(MinValueFloat = 0, MaxValueFloat = 100)]
91 [
Serialize(50.0f,
IsPropertySaveable.Yes, description:
"How much torque is used to rotate the tail to the correct orientation."),
Editable(MinValueFloat = 0, MaxValueFloat = 1000, ValueStep = 1)]
130 if (!
float.IsNaN(value))
141 [
Serialize(
false,
IsPropertySaveable.Yes, description:
"Instead of linear movement (default), use a wave-like movement. Note: WaveAmplitude and WaveLength don't have any effect on this. It's synced with the movement speed."),
Editable]
144 [
Editable,
Serialize(
true,
IsPropertySaveable.Yes, description:
"Should the character be flipped depending on which direction it faces. Should usually be enabled on all characters that have distinctive upper and lower sides.")]
150 [
Serialize(0.5f,
IsPropertySaveable.Yes, description:
"How much it takes before the character flips. The timer starts when the character starts to move in the different direction."),
Editable]
153 [
Editable,
Serialize(
true,
IsPropertySaveable.Yes, description:
"If enabled, the character will simply be mirrored horizontally when it wants to turn around. If disabled, it will rotate itself to face the other direction.")]
168 [
Serialize(50.0f,
IsPropertySaveable.Yes, description:
"How much torque is used to rotate the tail to the correct orientation."),
Editable(MinValueFloat = 0, MaxValueFloat = 2000, ValueStep = 1)]
171 [
Serialize(1f,
IsPropertySaveable.Yes, description:
"Multiplier applied based on the angle difference between the tail and the main limb. Increasing the value prevents snake-like characters from getting tangled on themselves. Default = 1 (no boost)"),
Editable(MinValueFloat = 1, MaxValueFloat = 100)]
198 if (!
float.IsNaN(value))
static string ParseFootAngles(Dictionary< int, float > footAngles)
static void SetFootAngles(Dictionary< int, float > footAngles, string value)
readonly CharacterPrefab Prefab
readonly AnimController AnimController
Dictionary< int, float > FootAnglesInRadians
Key = limb id, value = angle in radians
float? TailAngle
In degrees.
static bool Check(Character character)
float ColliderStandAngle
The angle of the collider when standing (i.e. out of water). In degrees.
float ColliderStandAngleInRadians
static FishRunParams GetDefaultAnimParams(Character character)
static FishRunParams GetAnimParams(Character character, Either< string, ContentPath > file, bool throwErrors=true)
static readonly FishRunParams Empty
override void StoreSnapshot()
static FishSwimFastParams GetAnimParams(Character character, Either< string, ContentPath > file, bool throwErrors=true)
static FishSwimFastParams GetDefaultAnimParams(Character character)
override void StoreSnapshot()
float TailTorqueMultiplier
bool UpdateAnimationWhenNotMoving
float? TailAngle
In degrees.
bool RotateTowardsMovement
Dictionary< int, float > FootAnglesInRadians
Key = limb id, value = angle in radians
static FishSwimSlowParams GetAnimParams(Character character, Either< string, ContentPath > file, bool throwErrors=true)
static FishSwimSlowParams GetDefaultAnimParams(Character character)
override void StoreSnapshot()
static readonly FishWalkParams Empty
static FishWalkParams GetAnimParams(Character character, Either< string, ContentPath > file, bool throwErrors=true)
override void StoreSnapshot()
static FishWalkParams GetDefaultAnimParams(Character character)
ContentPackage? ContentPackage
Dictionary< int, float > FootAnglesInRadians