GFX
  • Docs
  • API
Search Results for

    Show / Hide Table of Contents
    • Genesis.Core
      • AssetManager
      • Game
      • GameElement
      • GameEventHandler
      • GenesisWindow
      • IGameBehavior
      • Input
      • Layer
      • Light
      • Scene
      • Scene3D
      • SceneEventHandler
      • SceneSizeEvenHandler
      • Storage
      • Utils
    • Genesis.Core.Behaviors
      • AnimationBehavior
      • CameraFlags
      • CharacterController2D
      • ControllerPreset
      • MoveDirection
      • MovementFlags
      • SpriteMovementController
    • Genesis.Core.Behaviors.Physics2D
      • BufferedSpriteCollider
      • PhysicsBox2D
      • PhysicsPolygon2D
      • Rigidbody2D
    • Genesis.Core.Behaviors.Physics3D
      • BoxCollider
      • CapsuleCollider
      • ConvexHullBehavior
      • QubeConvexHull
      • SphereCollider
      • StaticMeshBehavior
    • Genesis.Core.Behaviors._3D
      • Stance
      • ThirdpersonCharacterController
    • Genesis.Core.GameElements
      • BufferedSprite
      • CameraElement
      • Element3D
      • Empty
      • Model
      • ParticleBuffers
      • ParticleDeffinition
      • ParticleEmitter
      • Qube
      • RectElement
      • Skybox
      • Sprite
      • SpriteShapeDeffinition
      • Terrain2D
      • Terrain3D
      • TerrainData
    • Genesis.Graphics
      • Animation
      • Camera
      • CameraType
      • Face
      • Font
      • Framebuffer
      • Glyphe
      • IRenderDevice
      • Material
      • MaterialBuffer
      • Mesh
      • PerspectiveCamera
      • Shader
      • ShaderProgram
      • TexCoords
      • Texture
      • Viewport
    • Genesis.Graphics.Animation3D
      • Animation
      • Animator
      • AssimpNodeData
      • Bone
      • KeyPosition
      • KeyRotation
      • KeyScale
      • ModelMesh
      • boneinfo
      • vertex
    • Genesis.Graphics.Physics
      • BulletDebugRenderer
    • Genesis.Graphics.RenderDevice
      • ClassicGL
      • GLRenderer
    • Genesis.Graphics.Shaders.OpenGL
      • AnimatedModelShader
      • BasicShader
      • DiffuseLightning
      • DiffuseNormalLightning
      • DiffuseNormalShader
      • DiffuseShader
      • DiffuseSolidShader
      • MVPRectShader
      • MVPShader
      • MVPSolidShader
      • ParticleShader
      • ScreenShader
      • SkyboxShader
      • SpriteShader
      • TerrainShader
      • WireframeShader
    • Genesis.Graphics.Shapes
      • BufferedSpriteShape
      • FrameShape
      • GlypheShape
      • LineShape
      • PlaneShape
      • QubeShape
      • RectShape
      • Shape
      • SpriteShape
    • Genesis.Math
      • Matrix4x4
      • NoisePoint
      • PerlinNoise
      • Rect
      • Vec3
    • Genesis.Physics
      • Aabb
      • HitResult
      • MatrixSet
      • MouseRay2
      • PhysicHandler
      • PhysicHandlerEvent
      • PhysicPropeterys
      • PhysicsBehavior
      • PhysicsBehaviorEvent
      • PhysicsHandler2D
      • PhysicsHandler3D
      • Raycast
    • Genesis.UI
      • Canvas
      • ImageButton
      • Label
      • ListItem
      • ListItemBehavior
      • ListSelector
      • ListSelectorBehavior
      • Panel
      • ProgressBar
      • UIEvent
      • UIParseHandler
      • UIParser
      • Widget

    Class CharacterController2D

    Class representing a 2D character controller as a game behavior.

    Inheritance
    object
    IGameBehavior
    CharacterController2D
    Inherited Members
    IGameBehavior.Parent
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    Namespace: Genesis.Core.Behaviors
    Assembly: Genesis.dll
    Syntax
    public class CharacterController2D : IGameBehavior

    Constructors

    CharacterController2D()

    Default constructor for CharacterController2D.

    Declaration
    public CharacterController2D()

    Properties

    AllowJump

    Gets or sets the jump cooldown duration in milliseconds.

    Declaration
    public bool AllowJump { get; set; }
    Property Value
    Type Description
    bool

    CameraFlags

    Gets or sets the camera flags for character control.

    Declaration
    public CameraFlags CameraFlags { get; set; }
    Property Value
    Type Description
    CameraFlags

    ColliderHeight

    Gets or sets the follider height

    Declaration
    public float ColliderHeight { get; set; }
    Property Value
    Type Description
    float

    ColliderRadius

    Gets or sets the collider radius

    Declaration
    public float ColliderRadius { get; set; }
    Property Value
    Type Description
    float

    DownKey

    Gets or sets the key for moving the character down.

    Declaration
    public Keys DownKey { get; set; }
    Property Value
    Type Description
    Keys

    JumpCooldown

    Gets or sets the jump cooldown in milliseconds

    Declaration
    public long JumpCooldown { get; set; }
    Property Value
    Type Description
    long

    JumpKey

    Gets or sets whether jumping is allowed.

    Declaration
    public Keys JumpKey { get; set; }
    Property Value
    Type Description
    Keys

    JumpSpeed

    Gets or sets the jump speed of the character.

    Declaration
    public float JumpSpeed { get; set; }
    Property Value
    Type Description
    float

    LeftKey

    Gets or sets the key for moving the character right.

    Declaration
    public Keys LeftKey { get; set; }
    Property Value
    Type Description
    Keys

    Mass

    Gets or sets the mass of the character.

    Declaration
    public float Mass { get; set; }
    Property Value
    Type Description
    float

    MoveDirection

    Gets the last movement direction from the character

    Declaration
    public MoveDirection MoveDirection { get; set; }
    Property Value
    Type Description
    MoveDirection

    MovementFlags

    Gets or sets the movement flags for character control.

    Declaration
    public MovementFlags MovementFlags { get; set; }
    Property Value
    Type Description
    MovementFlags

    RightKey

    Gets or sets the key for making the character jump.

    Declaration
    public Keys RightKey { get; set; }
    Property Value
    Type Description
    Keys

    Rigidbody

    Gets or sets the Rigidbody2D component for character physics.

    Declaration
    public Rigidbody2D Rigidbody { get; set; }
    Property Value
    Type Description
    Rigidbody2D

    Speed

    Gets or sets the speed of the character movement.

    Declaration
    public float Speed { get; set; }
    Property Value
    Type Description
    float

    UpKey

    Gets or sets the key for moving the character up.

    Declaration
    public Keys UpKey { get; set; }
    Property Value
    Type Description
    Keys

    Methods

    CharacterProcess(Game)

    Processes character movement and behavior based on user input.

    Declaration
    public void CharacterProcess(Game game)
    Parameters
    Type Name Description
    Game game

    The game instance.

    CreatePhysics(PhysicHandler)

    Creates default physics for the character with no specified factors.

    Declaration
    public void CreatePhysics(PhysicHandler physicHandler)
    Parameters
    Type Name Description
    PhysicHandler physicHandler

    The physics handler for creating the physics.

    CreatePhysics(PhysicHandler, ControllerPreset)

    Creates physics for the character based on the specified controller preset.

    Declaration
    public void CreatePhysics(PhysicHandler physicsHandler, ControllerPreset controllerPreset)
    Parameters
    Type Name Description
    PhysicHandler physicsHandler

    The physics handler for creating the physics.

    ControllerPreset controllerPreset

    The preset for the controller.

    CreatePhysics(PhysicHandler, Vec3, Vec3, bool)

    Creates physics for the character with specified factors and physics enabling.

    Declaration
    public void CreatePhysics(PhysicHandler physicHandler, Vec3 linearFactor, Vec3 angularFactor, bool enablePhysics)
    Parameters
    Type Name Description
    PhysicHandler physicHandler

    The physics handler for creating the physics.

    Vec3 linearFactor

    The linear factor for the physics.

    Vec3 angularFactor

    The angular factor for the physics.

    bool enablePhysics

    Specifies whether physics should be enabled initially.

    OnDestroy(Game, GameElement)

    Destruction method called when the game ends or the behavior is removed.

    Declaration
    public override void OnDestroy(Game game, GameElement parent)
    Parameters
    Type Name Description
    Game game

    The game instance.

    GameElement parent

    The parent GameElement of the behavior.

    Overrides
    IGameBehavior.OnDestroy(Game, GameElement)

    OnInit(Game, GameElement)

    Initialization method called when the game starts.

    Declaration
    public override void OnInit(Game game, GameElement parent)
    Parameters
    Type Name Description
    Game game

    The game instance.

    GameElement parent

    The parent GameElement of the behavior.

    Overrides
    IGameBehavior.OnInit(Game, GameElement)

    OnRender(Game, GameElement)

    Rendering method called during the rendering phase.

    Declaration
    public override void OnRender(Game game, GameElement parent)
    Parameters
    Type Name Description
    Game game

    The game instance.

    GameElement parent

    The parent GameElement of the behavior.

    Overrides
    IGameBehavior.OnRender(Game, GameElement)

    OnUpdate(Game, GameElement)

    Updates the character state on each frame.

    Declaration
    public override void OnUpdate(Game game, GameElement parent)
    Parameters
    Type Name Description
    Game game

    The game instance.

    GameElement parent

    The parent GameElement of the behavior.

    Overrides
    IGameBehavior.OnUpdate(Game, GameElement)
    In this article
    Back to top Generated by DocFX