소환수 관련 정리

This commit is contained in:
Ino 2025-05-07 07:41:40 +09:00
parent aabdf539d2
commit f82b6dd4c3
10 changed files with 62 additions and 23 deletions

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@ -232,6 +232,7 @@ MonoBehaviour:
m_animation: {fileID: 0}
_target: {fileID: 0}
isTarget: 0
m_HUDUI: {fileID: 0}
SummonType: 1
--- !u!65 &3665982464420144749
BoxCollider:
@ -252,8 +253,8 @@ BoxCollider:
m_ProvidesContacts: 0
m_Enabled: 1
serializedVersion: 3
m_Size: {x: 0.8517497, y: 0.5006471, z: 0.4424669}
m_Center: {x: 0, y: 0.25417534, z: 0}
m_Size: {x: 0.8517497, y: 3, z: 0.4424669}
m_Center: {x: 0, y: 1, z: 0}
--- !u!195 &6627957360363133212
NavMeshAgent:
m_ObjectHideFlags: 0

View File

@ -78,6 +78,7 @@ MonoBehaviour:
m_animation: {fileID: 0}
_target: {fileID: 0}
isTarget: 0
m_HUDUI: {fileID: 0}
SummonType: 0
--- !u!65 &-2765125427909759228
BoxCollider:
@ -98,8 +99,8 @@ BoxCollider:
m_ProvidesContacts: 0
m_Enabled: 1
serializedVersion: 3
m_Size: {x: 1.7796136, y: 1.7759378, z: 1.7948022}
m_Center: {x: -0.000000061891036, y: 0.3901482, z: 0.26109192}
m_Size: {x: 0.3926459, y: 3, z: 0.3131792}
m_Center: {x: 0.002838105, y: 1, z: 0.048234195}
--- !u!195 &1913404697311654592
NavMeshAgent:
m_ObjectHideFlags: 0

View File

@ -506,7 +506,7 @@ public class Actor : MyCoroutine
// }
// if (camShake) MyValue.m_RealCamera.ShakeCamera(1);
//}
MyValue.m_RealCamera.ShakeCamera(1);
if (_dinfo.Beater.IsMainPC()) MyValue.m_RealCamera.ShakeCamera(1);
#if UNITY_EDITOR
if (SceneManager.GetActiveScene().name == "StatTest")
@ -607,6 +607,7 @@ public class Actor : MyCoroutine
if (m_BoxCollider) m_BoxCollider.enabled = false;
m_NavMeshAgent.enabled = false;
m_IsLockTarget = false;
Del_Target();
Set_Outline(false);
}
@ -933,6 +934,7 @@ public class Actor : MyCoroutine
if (IsMainPC()) m_Target.Set_Outline(false);
}
m_Target = null;
isTarget = false;
}
public bool IsDead() { return DeadStatus || !gameObject.activeInHierarchy; }
public bool IsOnlyDead() { return DeadStatus; }

View File

@ -482,6 +482,12 @@ public class MobActor : Actor
// if (allies[i].Get_Target() == null)
// allies[i].Change_Target(false, m_Target, true);
}
else
{
var dist1 = DSUtil.Get_Distance(m_Target.Get_position(), Get_position());
var dist2 = DSUtil.Get_Distance(_dinfo.Beater.Get_position(), Get_position());
if (dist1 > dist2) Change_Target(false, _dinfo.Beater, true);
}
if (m_MonsterTableData.n_PassiveSkillID > 0 && !IsDead())
{

View File

@ -4,6 +4,7 @@ public class MyActor : Actor
{
protected float f_FindEnemyRange;
protected Actor OwnerActor;
protected bool isFollowOwner;
public override void Set_Target(bool forcefind = false)
{
@ -47,6 +48,15 @@ public class MyActor : Actor
}
if (IsStop || IsCC() || (GameUI.Ins && GameUI.Ins.IngameUI.Active_SelectSkillUI())) return;
if (isFollowOwner)
{
if (Complete_Destination())
{
Play_Idle();
isFollowOwner = false;
}
return;
}
base.Update();
@ -113,11 +123,18 @@ public class MyActor : Actor
}
protected void Follow_PC()
{
m_NavMeshAgent.stoppingDistance = 1f;
Play_Run();
Set_Path(OwnerActor.Get_position());
if (Complete_Destination())
Play_Idle();
if (isFollowOwner)
{
}
else
{
isFollowOwner = true;
Del_Target(true);
m_NavMeshAgent.stoppingDistance = 1f;
Play_Run();
Set_Path(OwnerActor.Get_position());
}
}
bool IsNotPC() { return !IsRole(eRole.PC); }
@ -127,7 +144,13 @@ public class MyActor : Actor
base.Get_Damage(_dinfo);
if (!isTarget || m_Target.IsDead())
{
m_Target = _dinfo.Beater;
Change_Target(false, _dinfo.Beater, true);
}
else
{
var dist1 = DSUtil.Get_Distance(m_Target.Get_position(), Get_position());
var dist2 = DSUtil.Get_Distance(_dinfo.Beater.Get_position(), Get_position());
if (dist1 > dist2) Change_Target(false, _dinfo.Beater, true);
}
}

View File

@ -15,6 +15,7 @@ public class SummonActor : MyActor
gameObject.SetActive(true);
OwnerActor = owner;
isFollowOwner = DeadStatus = false;
projctile_amount = projctileamount; projctile_amount.RandomizeCryptoKey();
m_Auto = true;
MaxLifeTime = LifeTime = _time;
@ -24,10 +25,11 @@ public class SummonActor : MyActor
m_Stat.Set_Stat(true, eStat.BaseDmg, m_Stat.Get_Stat(eStat.BaseDmg) * _attackrate);
m_Stat.Set_Stat(true, eStat.HP, m_Stat.Get_Stat(eStat.HP) * _hprate);
m_NavMeshAgent.speed = owner.Get_MoveSpeed();
Play_Idle();
Set_Warp(owner.Get_position() + Vector3.forward);
f_FindEnemyRange = table_GlobalValue.Ins.Get_Float("f_Pet_FindEnemyRange");
switch(SummonType)
switch (SummonType)
{
case eSummon.Golem:
m_NavStopDistance = 1.5f;
@ -61,24 +63,20 @@ public class SummonActor : MyActor
}
#endif
if (IsDead()) return;
if (LifeTime > 0f)
{
LifeTime -= Time.deltaTime;
Get_HUDUI().Set(this, LifeTime / MaxLifeTime);
if (LifeTime <= 0f)
{
Set_Die();
return;
}
}
if (DSUtil.CheckNull(OwnerActor))
if (LifeTime <= 0f || DSUtil.CheckNull(OwnerActor))
{
Set_Die();
End_Summon();
return;
}
if (!IsStop && (!isTarget || m_Target.IsDead()) && Vector3.Distance(OwnerActor.Get_position(), Get_position()) > 2)
if (!IsStop && (!isTarget || m_Target.IsDead()) && !DSUtil.WithInDistance(OwnerActor.Get_position(), Get_position(), 2f))
{ // 마녀 따라다니기
Follow_PC();
}
@ -89,6 +87,12 @@ public class SummonActor : MyActor
Play_Idle();
}
void End_Summon()
{
DeadStatus = true;
Set_Die();
}
protected override void After_Die()
{
base.After_Die();

View File

@ -49,6 +49,7 @@ public class PetActor : MyActor
public override void Set(bool isEnemy, Actor owner, ServerData sdata, int _id, bool _isstop, bool _ui = false)
{
isFollowOwner = false;
Del_Target();
OwnerActor = owner;
m_Role = eRole.Pet;

View File

@ -999,7 +999,8 @@ public static partial class DSUtil
public static float Get_SliderValue(float f) { return float.IsNaN(f) ? 0f : f; }
public static bool WithInDistance(Vector3 a, Vector3 b, float dist) { return (a - b).sqrMagnitude <= dist * dist; }
public static bool WithInDistance(Vector3 a, Vector3 b, float dist) { return Get_Distance(a, b) <= dist * dist; }
public static float Get_Distance(Vector3 a, Vector3 b) { return (a - b).sqrMagnitude; }
static public List<int> Get_T_List(List<ObscuredInt> lst)