2024-12-15 01:39:39 +00:00
|
|
|
using CodeStage.AntiCheat.ObscuredTypes;
|
|
|
|
|
using UnityEngine;
|
2024-12-28 00:20:09 +00:00
|
|
|
using UnityEngine.SceneManagement;
|
2024-12-15 01:39:39 +00:00
|
|
|
|
|
|
|
|
public enum eSummon { Golem, Worm }
|
|
|
|
|
|
|
|
|
|
public class SummonActor : MyActor
|
|
|
|
|
{
|
|
|
|
|
public eSummon SummonType;
|
|
|
|
|
float LifeTime, MaxLifeTime;
|
|
|
|
|
ObscuredInt projctile_amount = 1;
|
|
|
|
|
|
|
|
|
|
public void Set(bool isEnemy, Actor owner, float _time, float _attackrate, float _hprate, int projctileamount)
|
|
|
|
|
{
|
|
|
|
|
gameObject.SetActive(true);
|
|
|
|
|
OwnerActor = owner;
|
|
|
|
|
|
2025-05-06 22:41:40 +00:00
|
|
|
isFollowOwner = DeadStatus = false;
|
2024-12-15 01:39:39 +00:00
|
|
|
projctile_amount = projctileamount; projctile_amount.RandomizeCryptoKey();
|
|
|
|
|
m_Auto = true;
|
|
|
|
|
MaxLifeTime = LifeTime = _time;
|
|
|
|
|
m_Enemy = owner.IsEnemy();
|
|
|
|
|
m_ServerData = owner.Get_ServerData();
|
|
|
|
|
Set_Stat(true);
|
|
|
|
|
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();
|
2025-05-06 22:41:40 +00:00
|
|
|
Play_Idle();
|
2024-12-15 01:39:39 +00:00
|
|
|
|
|
|
|
|
Set_Warp(owner.Get_position() + Vector3.forward);
|
2025-05-06 07:05:38 +00:00
|
|
|
f_FindEnemyRange = table_GlobalValue.Ins.Get_Float("f_Pet_FindEnemyRange");
|
2025-05-06 22:41:40 +00:00
|
|
|
switch (SummonType)
|
2025-05-06 07:05:38 +00:00
|
|
|
{
|
|
|
|
|
case eSummon.Golem:
|
|
|
|
|
m_NavStopDistance = 1.5f;
|
|
|
|
|
InGameInfo.Ins.Show_Effect("Effect_Summoning_Golem", transform.position);
|
|
|
|
|
transform.localScale = Vector3.one * 3.0f;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
m_NavStopDistance = 3.5f;
|
|
|
|
|
InGameInfo.Ins.Show_Effect("Effect_Summoning", transform.position);
|
|
|
|
|
transform.localScale = Vector3.one * 1.5f;
|
|
|
|
|
break;
|
|
|
|
|
}
|
2024-12-15 01:39:39 +00:00
|
|
|
Set(isEnemy, owner, owner.Get_ServerData(), 0, true);
|
2025-03-05 03:47:01 +00:00
|
|
|
Get_HUDUI().Set_HPSlider(this);
|
2024-12-15 01:39:39 +00:00
|
|
|
|
|
|
|
|
Set_Coroutine(() =>
|
|
|
|
|
{
|
|
|
|
|
IsStop = false;
|
2025-05-06 07:05:38 +00:00
|
|
|
Set_Target();
|
2024-12-15 01:39:39 +00:00
|
|
|
}, 1f);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void Update()
|
|
|
|
|
{
|
|
|
|
|
base.Update();
|
|
|
|
|
|
2024-12-28 00:20:09 +00:00
|
|
|
#if UNITY_EDITOR
|
|
|
|
|
if (SceneManager.GetActiveScene().name == "StatTest")
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
2025-05-06 22:41:40 +00:00
|
|
|
if (IsDead()) return;
|
|
|
|
|
|
2024-12-15 01:39:39 +00:00
|
|
|
if (LifeTime > 0f)
|
|
|
|
|
{
|
|
|
|
|
LifeTime -= Time.deltaTime;
|
2025-03-05 03:47:01 +00:00
|
|
|
Get_HUDUI().Set(this, LifeTime / MaxLifeTime);
|
2024-12-15 01:39:39 +00:00
|
|
|
}
|
2025-05-06 22:41:40 +00:00
|
|
|
if (LifeTime <= 0f || DSUtil.CheckNull(OwnerActor))
|
2024-12-15 01:39:39 +00:00
|
|
|
{
|
2025-05-06 22:41:40 +00:00
|
|
|
End_Summon();
|
2024-12-15 01:39:39 +00:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2025-05-06 22:41:40 +00:00
|
|
|
if (!IsStop && (!isTarget || m_Target.IsDead()) && !DSUtil.WithInDistance(OwnerActor.Get_position(), Get_position(), 2f))
|
2024-12-15 01:39:39 +00:00
|
|
|
{ // 마녀 따라다니기
|
|
|
|
|
Follow_PC();
|
|
|
|
|
}
|
|
|
|
|
else if (CurAnim == eAnim.Run && m_NavMeshAgent.velocity == Vector3.zero)
|
|
|
|
|
Play_Idle();
|
|
|
|
|
|
|
|
|
|
if (CurAnim == eAnim.Attack && !isPlaying())
|
|
|
|
|
Play_Idle();
|
|
|
|
|
}
|
|
|
|
|
|
2025-05-06 22:41:40 +00:00
|
|
|
void End_Summon()
|
|
|
|
|
{
|
|
|
|
|
DeadStatus = true;
|
|
|
|
|
Set_Die();
|
|
|
|
|
}
|
|
|
|
|
|
2024-12-15 01:39:39 +00:00
|
|
|
protected override void After_Die()
|
|
|
|
|
{
|
|
|
|
|
base.After_Die();
|
|
|
|
|
Off();
|
2024-12-16 06:28:42 +00:00
|
|
|
InGameInfo.Ins.Show_Effect(SummonType == eSummon.Golem ? "Effect_Summoning_Golem" : "Effect_Summoning", transform.position);
|
2024-12-15 01:39:39 +00:00
|
|
|
}
|
|
|
|
|
}
|