#I want to implement a game where I will
1 messages · Page 1 of 1 (latest)
I think your approach is good, though personally I would try to generalize those systems a bit more, as managing "Player1", "Player2", "Player3" subclasses could probably become difficult if you decide to add more than 3 types of characters later on and if you need to perform logic like a jump you might need to check each type
Maybe you could have just a PlayerController that uses a Movement reference, that reference could be a base class or a interface, it could be a scriptable object you can change from the inspector or a instance you create at runtime, or just a component you add/remove - the movement can define generic actions that the specific type of movement can override/implement - even if you have vastly different abilities, the player would likely need to use a combination of the same input to execute those abilities, such as holding space to fly, tapping space to change gravity or simply perform a hop, or tapping space might toggle a visualization mode to teleport, etc
All of them still use the same key to "move", so "Move" can be a generic action, and a specific "Movement" class can decide what "Move" means, the PlayerController can become a specific character/have a characters abilities by defining which Movement to initialize - similar idea could be applied to other parts of your character as well, at least, this would be the approach I would take