Two Animations on one button at different times.
I am making Bloodborne styled weapons. I can not figure out how to get two clips to play at different times with the same button. In bloodborne, you hit L1 to get your weapon to change from form 1, to form 2. You do it again to go from form 2 to form 1.
One clip is named "retract" The other is "extend" Anybody have an idea on how to do this in C#? Using Unity 5.
Answer by Otaku_Riisu · Jun 03, 2016 at 12:08 AM
Make a Boolean checking for if the weapon is in extended or retracted form. For instace:
bool weaponTransformed = false;
Then, make a function to transform the weapon, and check for the boolean.
void Transfrom(){
if(Input.GetButtonDown("Transform"){
if (weaponTransformed = true) {
animator.Play ("Transform1");
} else {
animator.Play ("Transform2");
}
}
}
Just toss that in your void Update () and you're good to go!
You probably also want to add it so that when the weapon transforms it also sets the boolean to the right value.
So-
if (weaponTransformed = true) {
animator.Play ("Transform1");
weaponTransformed = false;
} else {
animator.Play ("Transform2");
weaponTransformed = true;
}
Oh god, yeah! Thank you so much for catching that. I totally forgot to add that ^^;
Your answer
Follow this Question
Related Questions
Click to Move Game tutorial - walking animation issue 0 Answers
ANIMATION SCRIPTS HELP: Can I Skip/Forward the animation that played by touch? using C# script 0 Answers
Randomly play multiple attack animation 0 Answers
Set Bool to false after seconds? 2 Answers
How do I make one animation for multiple characters? 0 Answers