돌진몹 완료
This commit is contained in:
parent
101e98aec4
commit
ca73946b07
|
|
@ -248,14 +248,7 @@ ModelImporter:
|
|||
mirror: 0
|
||||
bodyMask: 01000000010000000100000001000000010000000100000001000000010000000100000001000000010000000100000001000000
|
||||
curves: []
|
||||
events:
|
||||
- time: 0.23830736
|
||||
functionName: Projectile
|
||||
data:
|
||||
objectReferenceParameter: {instanceID: 0}
|
||||
floatParameter: 0
|
||||
intParameter: 0
|
||||
messageOptions: 0
|
||||
events: []
|
||||
transformMask: []
|
||||
maskType: 3
|
||||
maskSource: {instanceID: 0}
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
Binary file not shown.
|
|
@ -1,10 +1,18 @@
|
|||
using System.Collections;
|
||||
using UnityEngine;
|
||||
|
||||
public class BullRushMobActor : MobActor
|
||||
{
|
||||
protected override void Change_MobStatus(eMobStatus mobStatus)
|
||||
{
|
||||
if (mobStatus == eMobStatus.Battle)
|
||||
Play_Attack(0, m_MonsterTableData.f_BaseATKSpeed);
|
||||
else
|
||||
base.Change_MobStatus(mobStatus);
|
||||
}
|
||||
|
||||
public override void Play_Attack(int _attack, float _as)
|
||||
{
|
||||
if (isTarget) transform.LookAt(m_Target.transform);
|
||||
AnimationPlay(MyValue.Get_AnimName(eAnim.Attack));
|
||||
StartCoroutine(Co_Attack());
|
||||
}
|
||||
|
|
@ -15,14 +23,47 @@ public class BullRushMobActor : MobActor
|
|||
}
|
||||
|
||||
IEnumerator Co_Attack()
|
||||
{ // 거리에 상관없이 정해진 거리만큼 돌진하면서 공격하는 형태로 되어야할거 같아요
|
||||
{
|
||||
FindNextTarget(10000f);
|
||||
|
||||
Change_MobStatus(eMobStatus.None);
|
||||
|
||||
if (isTarget) transform.LookAt(m_Target.transform);
|
||||
Set_Path(Get_PositionFoward(10f));
|
||||
|
||||
while (!Complete_Destination())
|
||||
while (true)
|
||||
{
|
||||
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, 1f, 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);
|
||||
}
|
||||
}
|
||||
|
|
@ -220,7 +220,7 @@ public class MobActor : Actor
|
|||
}
|
||||
}
|
||||
|
||||
protected void Change_MobStatus(eMobStatus mobStatus)
|
||||
virtual protected void Change_MobStatus(eMobStatus mobStatus)
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
if (SceneManager.GetActiveScene().name == "StatTest") return;
|
||||
|
|
@ -329,11 +329,11 @@ public class MobActor : Actor
|
|||
// }
|
||||
//}
|
||||
|
||||
public void Set_Target(Actor _target) { m_Target = _target; }
|
||||
void FindNextTarget(float _dist)
|
||||
protected void FindNextTarget(float _dist)
|
||||
{
|
||||
switch (m_SubRole)
|
||||
{
|
||||
case eSubRol.Mimic: break;
|
||||
default:
|
||||
m_Target = ActorInfo.Ins.Get_Nearest_EnemyActor_orNull(IsEnemy(), Get_position());
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
using System.Collections;
|
||||
using UnityEngine;
|
||||
|
||||
public class Projectile_Stop : ProjectileBase
|
||||
|
|
@ -9,4 +10,15 @@ public class Projectile_Stop : ProjectileBase
|
|||
transform.eulerAngles = Vector3.zero; // 근접 공격 판정은 회전 x
|
||||
StartCoroutine(Co_Off(m_ProjecTileData.LifeTime));
|
||||
}
|
||||
|
||||
public void Set_FollowShooter() { StartCoroutine(Co_Follow()); }
|
||||
|
||||
IEnumerator Co_Follow()
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
transform.position = m_ProjecTileData.shooter.Get_CenterPositionFoward();
|
||||
yield return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue