top 이펙트 표시

This commit is contained in:
Ino 2025-03-03 10:55:09 +09:00
parent aef8aa4a0f
commit 45cbfe782d
3 changed files with 35 additions and 32 deletions

View File

@ -29,7 +29,7 @@ public class Actor : MyCoroutine
public Animator m_animation;
protected ActorStatInfo m_Stat;
protected double receiveaccumulateDmg, m_Damage, m_attackCoolTime; // 내가 받은 피해, 내가 준 피해, 공격 쿨타임
protected Transform tf_HUD_HP, tf_HUD_Dmg;
protected Transform tf_HUD_HP, tf_HUD_Dmg, tf_Top;
protected Vector3 ObjSize;
[SerializeField]
Actor _target;
@ -146,19 +146,10 @@ public class Actor : MyCoroutine
maxY = rendererMaxY;
}
}
maxY = Mathf.Min(0.5f, maxY);
var hud_hp = new GameObject("HUD_HP");
tf_HUD_HP = hud_hp.transform;
tf_HUD_HP.parent = transform;
tf_HUD_HP.position = Get_position() + Vector3.down * 0.1f;
// maxY를 기준으로 HUD 위치 조정
Vector3 headPosition = new Vector3(transform.position.x, maxY, transform.position.z);
var hud_dmg = new GameObject("HUD_Dmg");
tf_HUD_Dmg = hud_dmg.transform;
tf_HUD_Dmg.parent = transform;
tf_HUD_Dmg.position = headPosition;
Set_TF_HUD("HUD_HP", ref tf_HUD_HP, Get_position() + Vector3.down * 0.1f);
Set_TF_HUD("HUD_Dmg", ref tf_HUD_Dmg, Get_position() + Vector3.up * 0.5f);
Set_TF_HUD("HUD_Top", ref tf_Top, new Vector3(transform.position.x, maxY, transform.position.z));
}
protected virtual void Start()
@ -228,6 +219,14 @@ public class Actor : MyCoroutine
}
}
void Set_TF_HUD(string goname, ref Transform tf, Vector3 pos)
{
var hud = new GameObject(goname);
tf = hud.transform;
tf.parent = transform;
tf.position = pos;
}
public bool isPlaying()
{
float normalizedTime = m_animation.GetCurrentAnimatorStateInfo(0).normalizedTime;
@ -835,7 +834,7 @@ public class Actor : MyCoroutine
{
return new Vector3(transform.position.x, transform.position.y + ObjSize.y * 0.5f, transform.position.z);
}
public Vector3 Get_Top_postion() { return tf_HUD_Dmg.position; }
public Vector3 Get_Top_postion() { return tf_Top.position; }
public Vector3 Get_CenterPositionFoward(float dist = 0.3f) { return Get_Center_position() + transform.forward * dist; }
public Vector3 Get_PositionFoward(float dist = 0.3f) { return Get_position() + transform.forward * dist; }
public Vector3 Get_PositionBack(float dist = 0.3f) { return Get_position() + -transform.forward * dist; }

View File

@ -21,7 +21,6 @@ public class MobActor : Actor
protected MonsterTableData m_MonsterTableData;
protected Dictionary<SkillListTableData, int> dic_skill = new Dictionary<SkillListTableData, int>();
Action<int> m_actDie;
protected MobMark m_MobMark;
protected NoSeeLongDMob m_NoSeeLongDMob;
bool useMeeleAttackPos;
bool isNSLDMob;
@ -557,13 +556,12 @@ public class MobActor : Actor
public override int Get_Group() { return m_SpawnerId; }
protected override void Set_MobMark(bool active)
{
if (m_MobMark == null)
{
m_MobMark = InGameInfo.Ins.Get_Obj(eObj.MobMark).GetComponent<MobMark>();
m_MobMark.transform.localScale = Vector3.one * 0.2f;
}
m_MobMark.Set(active, tf_HUD_Dmg);
//if (m_MobMark == null)
//{
// m_MobMark = InGameInfo.Ins.Get_Obj(eObj.MobMark).GetComponent<MobMark>();
// m_MobMark.transform.localScale = Vector3.one * 0.2f;
//}
//m_MobMark.Set(active, tf_HUD_Dmg);
}
public override void Play_Hit()

View File

@ -1,5 +1,6 @@
using System.Collections;
using UnityEngine;
using static UnityEngine.GraphicsBuffer;
public class Projectile_Homing : ProjectileBase
{
@ -17,21 +18,26 @@ public class Projectile_Homing : ProjectileBase
{
while (m_ProjecTileData.LifeTime > 0)
{
// 목표 방향 계산
Vector3 direction = (m_ProjecTileData.target.Get_Center_position() - transform.position).normalized;
if (m_ProjecTileData.shooter.isTarget)
{
// 목표 방향 계산
Vector3 direction = (m_ProjecTileData.target.Get_Center_position() - transform.position).normalized;
// 현재 방향을 목표 방향으로 보간 (유도력 적용)
Vector3 newDirection = Vector3.Lerp(transform.forward, direction, homingStrength * Time.deltaTime).normalized;
// 현재 방향을 목표 방향으로 보간 (유도력 적용)
Vector3 newDirection = Vector3.Lerp(transform.forward, direction, homingStrength * Time.deltaTime).normalized;
// 새로운 방향으로 이동
transform.position += newDirection * speed * Time.deltaTime;
// 새로운 방향으로 이동
transform.position += newDirection * speed * Time.deltaTime;
// 투사체가 이동하는 방향을 바라보도록 회전
transform.forward = newDirection;
// 투사체가 이동하는 방향을 바라보도록 회전
transform.forward = newDirection;
yield return null;
yield return null;
m_ProjecTileData.LifeTime -= Time.deltaTime;
m_ProjecTileData.LifeTime -= Time.deltaTime;
}
else
break;
}
Off(true);