YegorStepanov / ProjectBeta

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ProjectBeta

Demo

Rotating on slopes

Rotating on slopes

Jumping

Movie_005

Climbing the stars

Movie_004

Architecture

The Player reads the input and passes it to the CharacterController. CharacterController implements the ICharacterController interface. When these methods are called, depending on the current state, the features are called in the correct and explicit order.

Important Notes

  • ICharacterController is an interfrace from the low-level Kinematic Character Controller package. Its engine calls the implemented methods (UpdateRotation, BeforeCharacterUpdate, etc) when needed.
  • Feature is an encapsulated logic of CharacterController: MovementFeature, JumpingFeature etc.

Example

public void UpdateVelocity(ref Vector3 currentVelocity, float deltaTime)
{
    switch (CurrentState)
    {
        case CharacterState.Default:
            _movementFeature.UpdateVelocity(ref currentVelocity, deltaTime);
            _jumpingFeature.UpdateVelocity(ref currentVelocity, deltaTime);
            _gravityFeature.UpdateVelocity(ref currentVelocity, deltaTime);
            _dragFeature.UpdateVelocity(ref currentVelocity, deltaTime);
            _externalForceFeature.UpdateVelocity(ref currentVelocity, deltaTime);
            break;
        case CharacterState.Charging:
            _chargingFeature.UpdateVelocity(ref currentVelocity, deltaTime);
            break;
        case CharacterState.NoClip:
            _noClipFeature.UpdateVelocity(ref currentVelocity, deltaTime);
            break;
        default:
            break;
    }
}

Settings

image

image

About


Languages

Language:C# 100.0%