private void Update() { //UIHPbar.rectTransform.right = new Vector3(hp / fullhp, 0,0); //Debug.Log(animator.GetCurrentAnimatorStateInfo(0).length + " " + animator.GetCurrentAnimatorStateInfo(0).normalizedTime + " " + animator.GetCurrentAnimatorClipInfo(0).Length); if (hp <= 0) { if (!animator.GetCurrentAnimatorStateInfo(0).IsName("Death")) { animator.SetTrigger("Death"); } if (speed > 0) { speed -= .5f; } //transform.position = Vector3.forward / 100; col.enabled = false; } if (animator.GetCurrentAnimatorStateInfo(0).length < (animator.GetCurrentAnimatorStateInfo(0).normalizedTime * 3f) && animator.GetCurrentAnimatorStateInfo(0).IsName("Death")) { PlayerController.IncrementKills(); PlayerController.gold += 10 + PlayerController.GetKillsCount() / 10; gameObject.SetActive(false); startPosition = new Vector3(Random.Range(correctPointForStartPositionX.x, correctPointForStartPositionX.y), startPosition.y, startPosition.z); transform.position = startPosition; } if (Vector3.Distance(target.position, transform.position) < attackRange) { animator.SetBool("Attack", true); } //Debug.Log(Vector3.Distance(target.position, transform.position)); //Debug.Log(animator.GetCurrentAnimatorStateInfo(0).length + " " + animator.GetCurrentAnimatorStateInfo(0).normalizedTime); }