Project_WL/Assets/Script/Character/PC/SummonActor.cs

89 lines
2.7 KiB
C#

using CodeStage.AntiCheat.ObscuredTypes;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
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);
m_HUDUI = InGameInfo.Ins.Get_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 ? 1.5f : 3.5f;
Set_Warp(owner.Get_position() + Vector3.forward);
InGameInfo.Ins.Show_Effect(SummonType == eSummon.Golem ? "Effect_Summoning_Golem" : "Effect_Summoning", transform.position);
Set(isEnemy, owner, owner.Get_ServerData(), 0, true);
Set_Coroutine(() =>
{
IsStop = false;
}, 1f);
}
protected override void Update()
{
base.Update();
#if UNITY_EDITOR
if (SceneManager.GetActiveScene().name == "StatTest")
{
return;
}
#endif
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 && (!isTarget || m_Target.IsDead()) && Vector3.Distance(OwnerActor.Get_position(), Get_position()) > 2)
{ // 마녀 따라다니기
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(SummonType == eSummon.Golem ? "Effect_Summoning_Golem" : "Effect_Summoning", transform.position);
}
}