using System;
using Framework.Services;
namespace Framework.Actors.Platformer {
/// How the character moves from the squatting stance
public enum SquatMovementMode {
/// The character is not allowed to moved around while squatting
Prohibit,
/// Movement while squatting results in slow sneaking walk
///
/// Many first and third person games allow characters to move silently,
/// lowering their stance for careful foot placement.
///
Sneak,
/// Movement while squatting results in going onto hands and feet
///
/// The character will movement on hands and feet, allowing him/her to clear
/// long obstacles such as tunnels.
///
Crawl
}
/// How the character deals with ledges
public enum LedgeHangMode {
/// The character is not allowed to hang onto the respective ledge
Prohibit,
/// The character can hang from the respective ledge but not climb it
/// >
/// This is typically used for poles, bars and other ledges that provide no
/// support for the character's feet.
///
HangOnly,
/// The character can hang and climb onto the respective ledge
///
/// This is typically used for walls where the character can hang onto the top
/// of the wall and pull him/herself up.
///
HangAndClimb
}
/// Abilities a playable character possesses
public class Abilities : ScriptComponent {
/// Number of jumps the character can do (reset upon ground contact)
///
///
/// Setting this number to zero prevents the character from jumping at all,
/// a value of 1 would allow normal jumping off the ground at 2 would allow
/// for one "air-jump" where the character gets an upwards impulse in mid-air.
///
///
/// Running off a platform also counts as one jump, so with this value set to 2,
/// after falling off a platform, the character can only jump off in mid-air once.
///
///
public int JumpCount = 1;
/// How high the character can jump with a normal jump
///
/// Player-controlled characters can control their jump high by how long the jump
/// key is held. This is the maximum height the character will achieve when
/// the jump key is not released until the apex of the jump or later.
///
public float JumpHeight = 2.0f;
#if false
/// How high the character can jump with a super jump
///
/// A super jump is done from when squatting and allows the character to jump
/// extra high, but without much horizontal momentum (and leaving the character
/// vulnerable while stopping and preparing the jump).
///
public float SuperJumpHeight = 3.0f;
#endif
/// How much the character can be controlled during a jump or fall
///
/// A factor of 1.0 means that the player can control the character's horizontal
/// movement in the air just as good as on the ground, a factor of 0.0 would prevent
/// the player from altering the character's trajectory at all after jumping off.
///
public float AirControlFactor = 1.0f;
/// How fast the character moves horizontally when sneaking
public float SneakingSpeed = 5.0f;
/// How fast the character moves horizontally when walking
public float WalkingSpeed = 10.0f;
/// How fast the character moves horizontally when running
public float RunningSpeed = 15.0f;
/// How fast the character moves horizontally when dashing
public float DashingSpeed = 25.0f;
/// How quickly the character accelerates
///
/// This goes for all movement speeds, so if the user holds the sprint key,
/// the character will accelerate quicker, still reaching the full speed
/// within this time.
///
public float SecondsToFullSpeed = 0.25f;
/// How long the jump button needs to be held for maximum jump height
///
///
/// If this is set to 0, the actor will always jump to the maximum height
/// without allowing the player to make smaller jumps. Other values indicate
/// the time for which the player has to hold the jump key to achieve maximum
/// height, allowing for smaller jumps by pressing the jump key for a shorter
/// duration
///
///
/// This works by 'boosting' the jump during the initial stage (applying
/// the required upwards force over a small time frame) rather than
/// applying the full force as a single impulse. Having extremely long boost
/// durations will not work because
///
///
public float JumpBoostDuration = 0.25f;
/// Speed at which the character can slide across the floor
///
///
/// This is an action-movie styled slide where the character throws him/herself
/// onto the ground from a run and slides a short distance across the ground,
/// possibly clearing an obstacle or evading a bullet.
///
///
/// Setting the required speed to infinity effectively disables floor sliding.
///
///
public float SpeedForFloorSlide = float.PositiveInfinity;
/// Whether the character can move extra fast
/// >
/// This is a simple sprint function that makes the character move faster when
/// the player holds the 'sprint' button.
///
public bool CanSprint = false;
/// Whether the character is able to burst into a high speed slide
///
/// Dashing is a popular ability made famous by the Megaman games. The character
/// will assume a horizontal pose and receive a boost in speed for a short moment,
/// allowing him/her to slide under obstacles or cross a gap at high speed.
///
public bool CanDash = false;
/// How far the actor will dash when the dash key is pressed
public float DashDistance = 2.0f;
/// Whether the character can dash in mid-jump
public bool CanAirDash = false;
/// Whether the player can jump off walls
public bool CanWallJump = false;
// Decide this via a predicate function? Some walls work, some don't.
//public Predicate IsJumpableWall;
// Decide this via a predicate function? Some walls work, some don't.
//public Predicate IsHangableWall;
/// Whether the character can slide down on a wall
///
/// If this is set with prohibited, pressing into a wall will
/// always have the character slide down said wall. With
/// enabled, pressing into the wall will fix the character and sliding will only occur if
/// the 'down' key is pressed at the same time.
///
public bool CanWallSlide = false;
// Decide this via a predicate function? Some walls work, some don't.
//public Predicate IsSlideableWall;
/// Whether the character is able to hang onto a wall
/// >
/// How the character handles walls where he/she is able to grab the top of
/// the wall with his/her hands. See the documentation of the
/// enumeration for an exaplanation of the options.
///
public LedgeHangMode WallHanging = LedgeHangMode.Prohibit;
/// Whether the character is able to hang onto a floating obstacle
/// >
/// How the character handles floating obstacles he/she is able to grab
/// the top of but has no foot support. Things like poles and floating platforms.
/// See the documentation of the enumeration for
/// an exaplanation of the options.
///
public LedgeHangMode PoleHanging = LedgeHangMode.Prohibit;
/// Whether the character can squat, lowering his/her height
///
/// This is an ability normally used for bullet avoidal. The character will
/// assume a squatting stance (knees bent, upper body upright). Together with
/// it could also be used for silent movement.
///
public bool CanSquat = false;
/// How movement is handled while the character is squatting
///
/// See the documentation of the enumeration
/// for an explanation of the various modes.
///
public SquatMovementMode SquatMovement = SquatMovementMode.Prohibit;
#if false // Disabled by setting 'SpeedForFloorSlide' to infinity
/// Whether the character can slide across the floor
///
/// This is a move that can only be executed while running. The actor will
/// slide across the floor, rapidly losing momentum but possibly clearing
/// an obstacle or evading a projectile.
///
public bool CanSlide = false;
#endif
}
} // namespace Framework.Actors.Platformer