My unity project is growing and I'm a little intimidated.
I've created a Player that has a ton of scripts that are working together. (It will be even bigger lately tho.) This is how it looks like.
All the scripts that the player is compound of inherits from a basic script that just contain some protected static variables that can be changed from all the other scripts, so I can check any state of the Player from any single script.
Some of those:
public class BasicCharacter : MonoBehaviour { protected static Rigidbody2D rb2d; protected static CharacterRenderer characterRenderer; protected static Vector2 directionLookingAt; protected static Vector2 movement; protected static Vector2 attackPos; protected static bool hasDashedAttack = false; protected static bool hasFinalizerAttack = false; protected static bool isUsingMovementSkills = false; protected static bool isStringingAttacks = false; ... This is an example of how I call some of that variables as condition to execute some other actions:
private GameObject GetAttackAnimation() { if(hasFinalizerAttack) { return empoweredAttackVFX; } else if (hasDashedAttack) { return dashedAttackVFX; } else if (isAttackCharged) { return chargedAttackVFX; } return basicAttackVFX; } My concern is that I don't feel I'm doing a clean and nice work here. I think it is a better way of facing this. In my code, I have to remember every single possible state the Player can be before introducing a new game mechanic.
I have a few questions:
Do I need a PlayerManager that keeps track of the possible behaviors?
Is there a way of not adding every single script to the game object so it could look cleaner?
Is the BasicCharacter script sustainable?

staticvariables for that ... what if you ever change your mind and want to have two players or simply two objects that behave similar?