void Update() { if (lasso) { DrawLasso(); } if (health.CurrentHealth < .25f * health.TotalHealth) { state = 3; } else if (health.CurrentHealth < 0.5f * health.TotalHealth) { state = 2; } else if (health.CurrentHealth < 0.75f * health.TotalHealth) { state = 1; } else { state = 0; } anim.SetInteger("state", state); hurt = angry || health.GetLastDamage() > 0 && Time.time - health.GetLastDamage() < 0.5f; anim.SetBool("hurt", hurt); anim.SetBool("jump", !grounded); if (disabledUntil >= 0 && Time.time > disabledUntil) { disabled = false; } }
void Update() { ProcessInput(); if (disabledUntil >= 0 && Time.time > disabledUntil) { disabled = false; } // Character states idle = h == 0; if (grounded && plunging) { plunging = false; } hurt = health.GetLastDamage() > 0 && Time.time - health.GetLastDamage() < 0.5f; // Animation states if (dead) { anim.SetTrigger("dead"); } else if (hurt) { anim.SetTrigger("idlescared"); } else if (plunging) { anim.SetTrigger("plunge"); } else if (idle) { if (scared) { anim.SetTrigger("idlescared"); } else { anim.SetTrigger("idle"); } } else { if (scared) { anim.SetTrigger("walkscared"); } else { anim.SetTrigger("walk"); } } }