IEnumerator IErode(Vector3 point) { Vector3 dir = (new Vector3(point.x, transform.position.y, 0) - transform.position).normalized; rotate(dir); rg.isKinematic = false; while (!activo && !checkFront() && !checkBack()) { rg.MovePosition(transform.position + dir * speedRode * Time.deltaTime); IAc.getAnim().SetBool("isAtack", true); if (auxTime > 0) { auxTime -= Time.deltaTime; } else { auxTime = timeMove; activo = true; } yield return(null); } auxTime = timeMove; IAc.getAnim().SetBool("isAtack", false); //rg.isKinematic = true; activo = false; }
IEnumerator IsetDestination() { while (!isStoped && Vector3.Distance(transform.position, destination) > stopDistance && !blocking) { Vector3 dir = Vector3.MoveTowards(transform.position, destination, speedMove * Time.deltaTime); rg.MovePosition(dir); isMoving = true; IAc.getAnim().SetBool("isMoving", true); yield return(null); } IAc.getAnim().SetBool("isMoving", false); isMoving = false; }