I used to use Scirra Contruct but decided to change to Unity, so I’m new with it.
My problem is:
I’m having problems to “tranfers” this situation:
(The image is somehow self explanatory, but if you don’t understand, please write below!)
The idea is, If I press “A” a counter willl receive its value + 1, then the values 1, 2 and 3 represents the number of the animation that will be played. If, when the animation is finished, the number still the same, the counter will return to 0, else the object will play the next animation…
Anyone can help me? (obs: using C#)
Got it somehow:
using UnityEngine;
using System.Collections;
public class NewBehaviourScript : MonoBehaviour {
Animator anim;
int att1,att2,att3;
// Use this for initialization
void Start () {
anim = GetComponent();
}
// Update is called once per frame
void Update () {
if (Input.GetKeyDown (KeyCode.A)) {
anim.SetInteger(“count”, anim.GetInteger(“count”)+ 1);
}
if (att1 == 0){
if (anim.GetInteger(“count”) == 1){
anim.SetTrigger(“Attack”);
att1 = 1;
att3 = 0;
}
}
if (att2 == 0){
if (anim.GetInteger(“count”) == 2){
anim.SetTrigger(“Attack2”);
att2 = 1;
att1 = 0;
}
}
if (att3 == 0){
if (anim.GetInteger(“count”) == 3){
anim.SetTrigger(“Attack3”);
att3 = 1;
att2 = 0;
anim.SetInteger(“count”,0);
}
}
}
}
The only thing now is that it doesn’t reset if I only execute one animation…
(I probably need time counter to do that…)