-
Notifications
You must be signed in to change notification settings - Fork 42
Character
ICharacter is the principal interface for the characters. It's a parent of one interface- IPhysicalCharacter which is the character that uses Rigidbody for the movement in the world.
From now on we are going to refer to the Physical Character.
The class that implements ICharacter is a "container" facade class - it has references to all the other classes and, if you implement a new component to the class and you need, for example IAttackManager, you should get it from the ICharacter class and store the references in your component.
- ICharacter class
- Rigidbody
- Stats
- Collider
- IMovement - current movement state. In charge of moving the character
- IAnimatorFacade - the layer to communicate with the animator
- IMovementDirection- the class that combines input with the camera to control the direction the player is moving
- IHealthComponent - in charge of dealing with taking damage
- IArmour - calculates the taken damage based on the armour
- IAttackManager - controls the attacking logic of the character
- CameraView cameraView - camera enum to change movementDirection
- FastEnumIntEqualityComparer FastEnumIntEqualityComparer - Optimized enum comparator for the Dictionary .Learn more in IMovement page
- Dictionary<MovementEnum, IMovement> movements - every possible movement states. Learn more in IMovement page
Make sure that all the classes that you need in your components(movement, health, animator, etc...) you get from the ICharacter. That's why the character has mainly only getters. It makes easier to control the dependencies and can remove possible bugs.
I recommend that you use that structure for building your character:
-
Player - ICharacter, Stats, Rigidbody, Physical Collider
-
Mesh - Animator, IAnimatorStateFacade, IChatacterAnimator
- Skeleton mesh
- Hurtboxes
-
Mesh - Animator, IAnimatorStateFacade, IChatacterAnimator
Stats is the class that contains all the stats of the character(health, speed, jump force, etc...)