Hello, I am a bit new to programming (I am a 3d artist) so please excuse me if its a stupid question Currently I am making an FPS and I have first person legs that are animated. Right now the legs work fine, however I am trying to make a state system. When the player presses βCβ the player crouches and when the player presses βCβ again the player uncrouches (a toggle function). So for the legs I wanted to create a state system so if the player presses βCβ the Crouch State is active and vise versa. So if the player presses βWβ while the Crouch State is active, the Crouch Walk Forward Animation plays (not just the walk animation.) Here is a piece of my code that I tried to make for the toggle state.
//Crouch Anim
//Toggle
if (Input.GetKey(KeyCode.C)){
Crouch=true;
Debug.LogWarning ("Crouch is true");
}
if (Crouch==true){
if (Input.GetKey(KeyCode.C)){
Crouch=false;
Debug.LogWarning ("Crouch is false");
}
}