- Home /
Animator subtracting float to change states in c#?
Fairly new to Unity so excuse me if there is an easier way to go about it, but i have five health states for the player that each has a unique sprite that i want the animator to change to based on the level of health the player is at. I have set up 5 different health states in the animator with a transition between them (so full health to 75%, 75% to 50% etc), while also setting up float parameters shown below.
I am wondering how in c# i can subtract the float value by 1 each time two game objects collide so that it can change from one state to the next.
Also bit of background about the project, the players health decreases each time two enemy objects collide with each other, so the player object never moves and is positioned at the top of the screen.
Your answer
Follow this Question
Related Questions
How can I access Animator parameters in C# 2 Answers
Can you help solve the following error? 1 Answer
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers