83 lines
2.4 KiB
C#
83 lines
2.4 KiB
C#
using CodeStage.AntiCheat.ObscuredTypes;
|
||
using System.Collections;
|
||
using System.Collections.Generic;
|
||
using UnityEngine;
|
||
|
||
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);
|
||
Make_HUDUI(() =>
|
||
{
|
||
m_HUDUI.gameObject.SetActive(true);
|
||
m_HUDUI.Set_HPSlider(1d, 1d);
|
||
});
|
||
OwnerActor = owner;
|
||
|
||
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();
|
||
m_NavStopDistance = f_FindEnemyRange = SummonType == eSummon.Golem ? 4.5f : 7f;
|
||
|
||
Set_Warp(owner.Get_position() + Vector3.forward);
|
||
InGameInfo.Ins.Show_Effect("Effect_Summoning", transform.position);
|
||
Set(isEnemy, owner, owner.Get_ServerData(), 0, true);
|
||
|
||
Set_Coroutine(() =>
|
||
{
|
||
IsStop = false;
|
||
}, 1f);
|
||
}
|
||
|
||
protected override void Update()
|
||
{
|
||
base.Update();
|
||
|
||
if (LifeTime > 0f)
|
||
{
|
||
LifeTime -= Time.deltaTime;
|
||
m_HUDUI.Set(LifeTime / MaxLifeTime);
|
||
if (LifeTime <= 0f)
|
||
{
|
||
Set_Die();
|
||
return;
|
||
}
|
||
}
|
||
|
||
if (DSUtil.CheckNull(OwnerActor))
|
||
{
|
||
Set_Die();
|
||
return;
|
||
}
|
||
|
||
if (!IsStop && (DSUtil.CheckNull(m_Target) || m_Target.IsDead()) && Vector3.Distance(OwnerActor.Get_position(), Get_position()) > 2)
|
||
{ // 마녀 ë”°ë<C2B0>¼ë‹¤ë‹ˆê¸°
|
||
Follow_PC();
|
||
}
|
||
else if (CurAnim == eAnim.Run && m_NavMeshAgent.velocity == Vector3.zero)
|
||
Play_Idle();
|
||
|
||
if (CurAnim == eAnim.Attack && !isPlaying())
|
||
Play_Idle();
|
||
}
|
||
|
||
protected override void After_Die()
|
||
{
|
||
base.After_Die();
|
||
Off();
|
||
InGameInfo.Ins.Show_Effect("Effect_Summoning", transform.position);
|
||
}
|
||
} |