using System;
using Framework.Services;
namespace Framework.Actors.Platformer {
/// Stores moves a player character can execute
///
///
/// This component can be added to an actor in order to support both caching
/// of moves and use of modified moves.
///
///
/// For example, to override the 'air' move (maybe to implement jetpack functionality
/// or special animations), you would derive your own class from the 'PlayerMoveRepository'
/// and override the method to instead return your special
/// air move implementation. The standard 'ground' move will, upon detecting the 'jump'
/// key, switch to the 'air' move through the repository, thus activating your special
/// air move implementation.
///
///
public class PlayerMoveRepository : ScriptComponent {
/// Returns and configures the move for ground-based movement
/// Downward velocity with which the ground was hit
/// The move that should be used for ground movement
///
/// The impact velocity can be safely ignored but allows for additional realism,
/// for example by using different "landing" animations for different impact strengths
/// or even deciding whether the actor should die rather than safely land.
///
public virtual Move GetGroundMove(float impactVelocity = 0.0f) {
if(this.groundMove == null) {
this.groundMove = new GroundMove();
}
return this.groundMove;
}
/// Returns and configures the move for movement through the air
/// Whether the character has jumped
/// The move that should be used for air movement
public virtual Move GetAirMove(bool jumped = false) {
if(this.airMove == null) {
this.airMove = new AirMove();
}
this.airMove.WasActivatedByJumping = jumped;
return this.airMove;
}
/// Returns and configures the move for dashing
/// The move that should be used for dashes
public virtual Move GetDashMove() {
if(this.dashMove == null) {
this.dashMove = new DashMove();
}
return this.dashMove;
}
/// Returns and configures the move for squatting
/// The move that should be used to squat
public virtual Move GetSquatMove() {
if(this.squatMove == null) {
this.squatMove = new SquatMove();
}
return this.squatMove;
}
/// Returns and configures the move for sliding across the ground
/// The move that should be used to slide
public virtual Move GetSlideMove() {
if(this.slideMove == null) {
this.slideMove = new SlideMove();
}
return this.slideMove;
}
/// Returns and configures the move for walking in a lowered stance
/// The move that should be used to walk in a lowered stance
public Move GetSneakMove() {
if(this.sneakMove == null) {
this.sneakMove = new SneakMove();
}
return this.sneakMove;
}
/// Returns and configures the move for crawling on all fours
/// The move that should be used to crawl on all fours
public Move GetCrawlMove() {
if(this.crawlMove == null) {
this.crawlMove = new CrawlMove();
}
return this.crawlMove;
}
/// Returns and configures the move for getting knocked back
/// The move that should be used to be knocked back
public Move GetKnockBackMove() {
if(this.knockBackMove == null) {
this.knockBackMove = new KnockBackMove();
}
return this.knockBackMove;
}
/// Move for controlling the actor on the ground
private GroundMove groundMove;
/// Move for controlling the actor in the air
private AirMove airMove;
/// Move where the actor dashes horizontally at high speed
private DashMove dashMove;
/// Move where the actor takes a lower stance
private SquatMove squatMove;
/// Move where the actor slides across the ground
private SlideMove slideMove;
/// Move where the actor walks in a lowered stance
private SneakMove sneakMove;
/// Move where the actor crawls on all fours
private CrawlMove crawlMove;
/// Move where the actor is knocked back
private KnockBackMove knockBackMove;
}
} // namespace Framework.Actors.Platformer