Change walking anim if gun is picked up?

Hi so im working on a 2.5d sidescrolling game and was wondering if it is possible to change the walk animation based on if the character has found and picked up a gun. Right now i have a script for my character to be able to run, idle and sneak (walk) and i have animations for running, idleing and sneaking. So what i need help with is to change the animation for sneak, sprint and idle when i have picked up the gun.

Yes, use the Animator Controller and add a bool variable for whether or not the player has a gun. You can easily toggle that with a script attached to the object and a reference to the Animator Controller.

From there, add transitions from each of the animations to their with/without gun counterparts with a conditional for that bool variable.

If you want to get fancy with it, you can add additional middle state animations for holstering.