Awesome series of tutorials. I would like interaction with the camera in the next tutorial, namely tracking the player and when the camera is turned in the opposite direction from the player, when pressing the forward key, the player walked in the direction of the camera.
@_zeldaking_58302 жыл бұрын
Keep it up!
@osoascam2 жыл бұрын
Great tutorial. I used it as a base for learning unity (along with some other Character Controller tutorials) and this is by far the one with the most organized architecture. I have a couple of questions, though. 1. How would I change the states in order to add a state in which you have to smash a button for it to work (say, the quick time events in games where you have to smash Circle for filling up a bar) 2. How would I change the states in order to add a state in which you have to continuously press a button? This confuses me because we don't have access in the States to the release of a button, so, how would we know when to enter ExistState?
@dahstroyer2 жыл бұрын
Ive figured out what to do. Pretty much InputValue is the simplied version of how to handle unity's input system. What you do is get the input action class that was generated. and then get the action you want to handle this is what it should look like CharacterMovement characterInput; //this the auto generated class private void Awake() { characterInput = new CharacterMovement(); } public void OnRun(InputValue input) { characterInput.Character.Run.started += ctx => { SwitchState(runState); }; characterInput.Character.Run.canceled += ctx => { SwitchState(idleState); }; }
@osoascam2 жыл бұрын
@@dahstroyer Thank you very much!
@osoascam2 жыл бұрын
@@dahstroyer In case this helps anybody... so, I didn't like the autogenerated class, so I changed it to Invoke Unity Events. That means that on PlayerStateManager I did this on the Start() method: moveAction.performed += OnMove; moveAction.canceled += OnMove; jumpAction.performed += OnJump; And of course I had to add these properties to the class: moveAction = input.actions["Move"]; jumpAction = input.actions["Jump"]; I just liked this approach more since I feel it gave me more flexibility.
@BitByteBit_2 жыл бұрын
That’s awesome! I’m glad you were able to find something that worked well for your project! Thanks for sharing!