public override void OnStart() { chaseTarget = target.GetValue() as Transform; m_currentVisibilityBuffer = 0; m_currentChaseTime = 0; m_currentMaxChaseTime = Random.Range(minChaseTime, maxChaseTime + 1); errorMargin = moveSpeed * 0.05f; // Generate Path path = null; currentPathWaypoint = 1; // Only Trigger the Animation if movement is actually going to be performed - Check closeEnough distance as well! if (triggerAnimation && Vector2.Distance(new Vector2(transform.position.x, transform.position.z), new Vector2(chaseTarget.position.x, chaseTarget.position.z)) > closeEnough) { for (int i = 0; i < triggers.Count; i++) { anim.ResetTrigger(triggers[i]); } anim.SetTrigger(animTrigger); } }
public override void OnStart() { // Get the current target everytime the node is executed m_currentTarget = target.GetValue() as Transform; // Trigger Animation if (triggerAnimation) { for (int i = 0; i < triggers.Count; i++) { anim.ResetTrigger(triggers[i]); } anim.SetTrigger(animTrigger); } }