using System; using System.Collections; using UnityEngine; public class BullRushMobActor : MobActor { public override void Change_MobStatus(eMobStatus mobStatus) { if (mobStatus == eMobStatus.Battle) Play_Attack(0, (float)m_Stat.Get_Stat(eStat.FinalAttackSpeed)); else base.Change_MobStatus(mobStatus); } public override void Play_Attack(int _attack, float _as, Action actsuccess = null) { AnimationPlay(MyValue.Get_AnimName(eAnim.Attack)); StartCoroutine(Co_Attack()); } public override void KnockBack(double _time, float speed = 4, Action after = null, bool ignorePreknockback = false) { return; } IEnumerator Co_Attack() { FindNextTarget(10000f); Change_MobStatus(eMobStatus.None); while (true) { if (!isTarget) yield break; Vector3 directionToTarget = (m_Target.Get_position() - transform.position).normalized; Quaternion lookRotation = Quaternion.LookRotation(new Vector3(directionToTarget.x, 0, directionToTarget.z)); transform.rotation = Quaternion.Slerp(transform.rotation, lookRotation, Time.deltaTime * 5f); if (Quaternion.Angle(transform.rotation, lookRotation) < 5f) break; yield return null; } transform.LookAt(m_Target.transform); // 네비메시 비활성화 m_NavMeshAgent.enabled = false; yield return new WaitForSeconds(1f); ProjectileInfo.Ins.Shoot_Projectile(m_MonsterTableData.s_Porjectile1, this, m_Target, 1f, Get_CenterPositionFoward(), m_MonsterTableData.f_ProjectileLifeTime1, pb => { (pb as Projectile_Stop).Set_FollowShooter(); }); // 돌진 실행 float dashDistance = 10f; Vector3 startPos = transform.position; Vector3 dashDirection = transform.forward; // 현재 바라보는 방향으로 돌진 float traveledDistance = 0f; while (traveledDistance < dashDistance) { float moveStep = m_NavSpeed * Time.deltaTime; transform.position += dashDirection * moveStep; traveledDistance += moveStep; yield return null; } // 네비메시 다시 활성화 m_NavMeshAgent.enabled = true; Change_MobStatus(eMobStatus.PatrolWait); } }