i’ve some points about my assault animations
proper now, i am doing my mild assault which has 3 separate assaults and animations. the scripting and set off works(with out animation), however my animation simply does not carry on enjoying from 1st to second to final assault, nonetheless, the boolean for the animator appears to work correctly.
i’ve set their transitions’ interruption as “present state then subsequent state”.
as i needed to make the set off “in sync” with the animation, i’ve set my boolean to false because the set off disabled.
I am new with the animation, so i would want some advise for animating if avaliable
edit: need to know if it is attainable to refer different gameobject/kids/dad and mom in animation? as i wish to refer the set off outdoors the thing with animator part.
public class playerAttack : MonoBehaviour {
non-public bool attacking = false;
non-public bool heavyAttacking = false;
public KeyCode lightATK;
public KeyCode secondATK;
public KeyCode finalATK;
public KeyCode heavyATK;
non-public float comboResetTimer = 1f;
non-public int combo = 0;
non-public float comboTimer = 0f;
//non-public int attackcheck =0;
non-public float attackTimer = 0;
non-public float attackCD = 0.3f;
public Collider2D lightAttackTrigger;
public Collider2D comboAttackTrigger;
public Collider2D comboFinishTrigger;
public Collider2D heavyAttackTrigger;
public bool firstATK = true;
public bool SecondATK = false;
public bool thirdATK = false;
non-public Animator anim;
void Awake() {
anim = gameObject.GetComponent<Animator> ();
lightAttackTrigger.enabled = false;
comboAttackTrigger.enabled = false;
comboFinishTrigger.enabled = false;
heavyAttackTrigger.enabled = false;
}
// Replace is known as as soon as per body
void Replace() {
if (firstATK)
{
if (Enter.GetKeyDown(lightATK) && !attacking) {
attacking = true;
attackTimer = attackCD;
comboTimer = comboResetTimer;
combo += 1;
firstATK = false;
SecondATK = true;
lightAttackTrigger.enabled = true;
}
}
if (SecondATK)
{
if (Enter.GetKeyDown(lightATK) && !attacking)
{
attacking = true;
attackTimer = attackCD;
comboTimer = comboResetTimer;
combo += 1;
SecondATK = false;
thirdATK = true;
comboAttackTrigger.enabled = true;
}
}
if (thirdATK)
{
if (Enter.GetKeyDown(lightATK) && !attacking)
{
attacking = true;
attackTimer = attackCD;
comboTimer = comboResetTimer;
thirdATK = false;
combo += 1;
comboFinishTrigger.enabled = true;
}
}
if (attacking) {
if (combo == 1)
{
Debug.Log("nico");
if (attackTimer > 0)
{
attackTimer -= Time.deltaTime;
anim.SetBool("LightAttacking", true);
}
else
{
attacking = false;
lightAttackTrigger.enabled = false;
// anim.SetBool("LightAttacking", false);
}
}
if (combo ==2)
{
Debug.Log("NICO");
if (attackTimer > 0)
{
attackTimer -= Time.deltaTime;
anim.SetBool("2ndLAttack", true);
}
else
{
attacking = false;
comboAttackTrigger.enabled = false;
anim.SetBool("2ndLAttack", false);
}
}
if (combo == 3)
{
Debug.Log("NI!!!!!!!");
if (attackTimer > 0)
{
attackTimer -= Time.deltaTime;
anim.SetBool("FinalLAttack", true);
}
else
{
attacking = false;
comboFinishTrigger.enabled = false;
comboTimer = 0f;
anim.SetBool("FinalLAttack", false);
}
}
}
if (comboTimer > 0) //rely down tombo timer
{
Debug.Log("counting...");
comboTimer -= Time.deltaTime;
}
else
{
combo = 0;
//Debug.Log("Combo Reset");
firstATK = true;
SecondATK = false;
thirdATK = false;
}
if (Enter.GetKeyDown(heavyATK) && !heavyAttacking) {
Invoke("heavyAttack", 0.5f);
}
if (heavyAttacking) {
if (attackTimer > 0) {
attackTimer -= Time.deltaTime;
} else {
heavyAttacking = false;
heavyAttackTrigger.enabled = false;
}
}
}
void heavyAttack()
{
heavyAttackTrigger.enabled = true;
heavyAttacking = true;
attackTimer = attackCD;
Debug.Log("Heavy Attacked");
}
}