163 lines
5.9 KiB
C#
163 lines
5.9 KiB
C#
|
|
using UnityEngine;
|
||
|
|
|
||
|
|
public class MobActor : Actor
|
||
|
|
{
|
||
|
|
[SerializeField] protected SpriteRenderer sr_actor;
|
||
|
|
public GameObject go_shadow, go_targeteffect;
|
||
|
|
|
||
|
|
eMobBattlePos m_MobLine;
|
||
|
|
int m_MobIndex;
|
||
|
|
|
||
|
|
protected override void Awake()
|
||
|
|
{
|
||
|
|
base.Awake();
|
||
|
|
go_shadow.SetActive(false);
|
||
|
|
}
|
||
|
|
|
||
|
|
public override void Set(int identity, ActorTableDataBase actordata, HUD_HPShield hUD_HPShield, ServerData sdata = null)
|
||
|
|
{
|
||
|
|
if (actordata != null)
|
||
|
|
{
|
||
|
|
base.Set(identity, actordata, hUD_HPShield);
|
||
|
|
m_anim.Play("Mob_Dissolve_Init");
|
||
|
|
|
||
|
|
Load_SpriteRenderer(sr_actor, m_TableData.Get_ImagePath(), () =>
|
||
|
|
{
|
||
|
|
isSetImage = true;
|
||
|
|
if (IsRole(eRole.Mob)) Set_HUD(true);
|
||
|
|
});
|
||
|
|
var scale = (m_TableData as MonsterListTableData).f_Scale;
|
||
|
|
sr_actor.transform.localScale = Vector3.one * scale;
|
||
|
|
go_shadow.transform.localScale = new Vector3(2.0f, 2f) * scale;
|
||
|
|
go_shadow.SetActive(true);
|
||
|
|
|
||
|
|
go_targeteffect.SetActive(false);
|
||
|
|
go_targeteffect.transform.localScale = new Vector3(3.5f, 2f) * scale;
|
||
|
|
}
|
||
|
|
else
|
||
|
|
Off();
|
||
|
|
}
|
||
|
|
public override void Set(int index)
|
||
|
|
{
|
||
|
|
m_MobIndex = index;
|
||
|
|
}
|
||
|
|
public override void Set_TargetObj(bool active)
|
||
|
|
{
|
||
|
|
go_targeteffect.SetActive(active);
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
public override Vector3 Get_World_Position(eEffectPivot pivot = eEffectPivot.Center)
|
||
|
|
{
|
||
|
|
Bounds b = sr_actor.bounds;
|
||
|
|
var rtn = b.center;
|
||
|
|
switch (pivot)
|
||
|
|
{
|
||
|
|
case eEffectPivot.Top:
|
||
|
|
rtn = new Vector3(b.center.x, b.max.y, b.center.z); // 상단
|
||
|
|
break;
|
||
|
|
case eEffectPivot.Bottom:
|
||
|
|
rtn = new Vector3(b.center.x, b.min.y, b.center.z); // 하단
|
||
|
|
break;
|
||
|
|
}
|
||
|
|
|
||
|
|
return rtn;
|
||
|
|
}
|
||
|
|
public override void Set_Line(eMobBattlePos eline) { m_MobLine = eline; }
|
||
|
|
public override eMobBattlePos Get_Line() { return m_MobLine; }
|
||
|
|
public override bool IsFrontLine() { return m_MobLine == eMobBattlePos.Frontline; }
|
||
|
|
public override bool IsMiddleLine() { return m_MobLine == eMobBattlePos.Middleline; }
|
||
|
|
public override bool IsBackLine() { return m_MobLine == eMobBattlePos.Backline; }
|
||
|
|
public override bool IsMobLine(eMobBattlePos eline) { return m_MobLine == eline; }
|
||
|
|
public override int Get_MobIndex() { return m_MobIndex; }
|
||
|
|
public override void Set_MobIndex_byLineChange() { m_MobIndex -= 3; }
|
||
|
|
protected override float Get_ProjectileSpeed()
|
||
|
|
{
|
||
|
|
if (IsFrontLine())
|
||
|
|
return table_GlobalValue.Ins.Get_Float("FrontMonster_ProjectileSpeed");
|
||
|
|
else if(IsMiddleLine())
|
||
|
|
return table_GlobalValue.Ins.Get_Float("BackMonster_ProjectileSpeed");
|
||
|
|
return base.Get_ProjectileSpeed();
|
||
|
|
}
|
||
|
|
|
||
|
|
protected override void Set_Die(ProjectileData pdData)
|
||
|
|
{
|
||
|
|
base.Set_Die(pdData);
|
||
|
|
go_shadow.SetActive(false);
|
||
|
|
go_targeteffect.SetActive(false);
|
||
|
|
m_anim.Play("Mob_Dissolve");
|
||
|
|
EffectMgr.Ins.Show_Effect("FX_Skull_Dead", Get_World_Position());
|
||
|
|
var tData = m_TableData as MonsterListTableData;
|
||
|
|
bool isPdData = pdData != null;
|
||
|
|
|
||
|
|
// 정인호 : 몬스터 처치 보상
|
||
|
|
var exp = tData.n_RewardExp;
|
||
|
|
if (isPdData && pdData.isCri)
|
||
|
|
{
|
||
|
|
var G1_XpGainOnCritKill = pdData.Hitter.Get_CardSkillData_orNull(eCardType.G1_XpGainOnCritKill);
|
||
|
|
if (G1_XpGainOnCritKill != null) exp = (int)(exp * G1_XpGainOnCritKill.m_Data.Get_FloatValue2());
|
||
|
|
}
|
||
|
|
IngameUIManager.Ins.m_MoneyAnimation.Set(MyValue.ItemID_Exp, exp, Get_World_Position());
|
||
|
|
|
||
|
|
var golddroprate = tData.f_GoldDropRate;
|
||
|
|
if (isPdData)
|
||
|
|
{
|
||
|
|
var G1_GoldDropChanceUp = pdData.Hitter.Get_CardSkillData_orNull(eCardType.G1_GoldDropChanceUp);
|
||
|
|
if (G1_GoldDropChanceUp != null) golddroprate += G1_GoldDropChanceUp.m_Data.Get_FloatValue2();
|
||
|
|
}
|
||
|
|
|
||
|
|
if (DSUtil.RandomTrue(golddroprate))
|
||
|
|
{
|
||
|
|
var gold = tData.Get_Gold();
|
||
|
|
IngameUIManager.Ins.m_MoneyAnimation.Set(MyValue.ItemID_Gold, gold, Get_World_Position());
|
||
|
|
if (isPdData)
|
||
|
|
{
|
||
|
|
var G1_HealOnGoldDrop = pdData.Hitter.Get_CardSkillData_orNull(eCardType.G1_HealOnGoldDrop);
|
||
|
|
if (G1_HealOnGoldDrop != null)
|
||
|
|
{
|
||
|
|
pdData.Hitter.Heal(eHealType.Normal, G1_HealOnGoldDrop.m_Data.Get_IntValue1());
|
||
|
|
pdData.Hitter.Set_StatusEffect(eStatusConditionsType.Heal_Hp_Add, 1f);
|
||
|
|
}
|
||
|
|
var G1_ShockDamageOnGoldDrop = pdData.Hitter.Get_CardSkillData_orNull(eCardType.G1_ShockDamageOnGoldDrop);
|
||
|
|
if (G1_ShockDamageOnGoldDrop != null)
|
||
|
|
{
|
||
|
|
var rdnTarget = InGameInfo.Ins.Get_Enemy_orNull(pdData.Hitter.Get_Data().m_Role);
|
||
|
|
pdData.Hitter.Shoot_AddProjectiles(eCardType.G1_ShockDamageOnGoldDrop, rdnTarget);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
protected override void Play_Attack()
|
||
|
|
{
|
||
|
|
if (!IsDead())
|
||
|
|
{
|
||
|
|
if (Get_AttackType() == eAttackType.Melee)
|
||
|
|
{
|
||
|
|
if (m_MobLine == eMobBattlePos.Frontline)
|
||
|
|
{
|
||
|
|
base.Play_Attack();
|
||
|
|
m_anim.Play("Mob_Attack");
|
||
|
|
}
|
||
|
|
}
|
||
|
|
else
|
||
|
|
{
|
||
|
|
if (m_MobLine == eMobBattlePos.Frontline || m_MobLine == eMobBattlePos.Middleline)
|
||
|
|
{
|
||
|
|
base.Play_Attack();
|
||
|
|
m_anim.Play("Mob_Attack");
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
public override void Shoot_Projectile()
|
||
|
|
{
|
||
|
|
base.Shoot_Projectile();
|
||
|
|
InGameInfo.Ins.OnEvent_Mob_ShootProjectile(this);
|
||
|
|
}
|
||
|
|
protected override void Play_Hit()
|
||
|
|
{
|
||
|
|
//if(m_anim.IsPlaying())
|
||
|
|
if (!IsDead() && !m_anim.isPlaying) m_anim.Play("Mob_Hit");
|
||
|
|
}
|
||
|
|
}
|