This repository demonstrates a character movement system in Unity, utilizing the Strategy design pattern to switch between different movement behaviors at runtime.
- Character.cs: Manages the character's movement using a specified strategy.
- IMovementStrategy.cs: Interface for defining movement strategies.
- FastMovement.cs: Implements fast movement behavior.
- NormalMovement.cs: Implements normal movement behavior.
- SlowMovement.cs: Implements slow movement behavior.
- GameController.cs: Handles user input to change the character's movement strategy.
- Character: Uses a movement strategy to move. The strategy can be set at runtime.
- IMovementStrategy: Interface that defines the
Move
method for different movement behaviors.
- FastMovement: Moves the character quickly.
- NormalMovement: Moves the character at a normal speed.
- SlowMovement: Moves the character slowly.
- GameController: Initializes the character with a default movement strategy and changes the strategy based on user input.