using System; using Framework.Services; namespace Framework.Actors.Shooter { /// 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; } /// Move for controlling the actor on the ground private GroundMove groundMove; /// Move for controlling the actor in the air private AirMove airMove; } } // namespace Framework.Actors.Shooter