protected override void Update() { base.Update(); if (!isABoss) { img_Health.fillAmount = Health.GetCurrentValue() / Health.GetBaseValue(); img_StunMeter.fillAmount = StunMeterCurrentValue / StunMeterMaximumValue; img_Barrier.fillAmount = Barrier.GetCurrentValue() / Health.GetBaseValue(); } if (target == null) { return; } if (Vector3.Distance(target.transform.position, transform.position) <= attackRangeDetection && Vector3.Distance(target.transform.position, transform.position) > walkBackRangeDetection) { RaycastHit hitray; Rotation(); if (Physics.Raycast(transform.position, transform.TransformDirection(Vector3.forward), out hitray, 1000) && CanAttack) { if (hitray.collider.tag == "Player") { UseBasicAttack(target); } Debug.DrawLine(transform.position, transform.TransformDirection(Vector3.forward) * 1000, Color.yellow); } } else { if (TargetDetection()) { Rotation(); } if (CanMove) { Movement(); } if (DashCooldown.IsFinish()) { StartCoroutine(ActivateDash()); } } Death(); }
// Update is called once per frame protected override void Update() { base.Update(); if (target == null) { target = GameObject.FindGameObjectWithTag("Player").transform; } if (Vector3.Distance(target.transform.position, transform.position) <= attackRangeDetection && Vector3.Distance(target.transform.position, transform.position) > walkBackRangeDetection && TargetDetection()) { RaycastHit hitray; Rotation(); if (Physics.Raycast(transform.position, transform.TransformDirection(Vector3.forward), out hitray, 1000) && CanAttack) { if (hitray.collider.tag == typeOfTarget.ToString()) { UseBasicAttack(target); } Debug.DrawLine(transform.position, transform.TransformDirection(Vector3.forward) * 1000, Color.yellow); } } else { if (TargetDetection()) { Rotation(); } if (CanMove) { Movement(); } if (DashCooldown.IsFinish()) { StartCoroutine(ActivateDash()); } } }