투사체 정보 데이터, 몬스터 투사체 발사 등

This commit is contained in:
Ino 2026-01-13 15:20:15 +09:00
parent 392f3cd555
commit 8bd28fdbbd
6 changed files with 42 additions and 14 deletions

View File

@ -5128,6 +5128,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 5d5c7d7015715f149a39eab8276626c3, type: 3}
m_Name:
m_EditorClassIdentifier:
go_child: {fileID: 0}
texts_money:
- {fileID: 351787397619305963}
- {fileID: 351787398816937878}

View File

@ -34,7 +34,12 @@ public class AimArrowController : MonoBehaviour
isAiming = false;
var unit = IngameMgr.Ins.Get_CurUnitTData();
ProjectileMgr.Ins.Get(unit.n_ProjectileID, arrow.transform).Set(unit.n_ProjectileID);
ProjectileMgr.Ins.Shoot_Projectile(new ProjectileData
{
IsPC = true,
m_Data = table_projectile.Ins.Get_Data(unit.n_ProjectileID),
tf_Start = arrow.transform
});
}
void UpdateArrow(Vector2 currentPos)

View File

@ -77,6 +77,12 @@ public class MobActor : MonoBehaviour
IEnumerator Co_AttackProjectile()
{
yield return new WaitForSeconds(1f);
ProjectileMgr.Ins.Get(m_Data.n_ProjectileID, transform).Set(m_Data.n_ProjectileID);
ProjectileMgr.Ins.Shoot_Projectile(new ProjectileData
{
IsPC = false,
m_Data = table_projectile.Ins.Get_Data(m_Data.n_ProjectileID),
tf_Start = transform
});
}
}

View File

@ -38,8 +38,8 @@ public class IngameMgr : MonoBehaviourSingletonTemplate<IngameMgr>
{
texts_money[0].text = m_Coin.ToString();
texts_money[1].text = m_Item.ToString();
texts_money[2].text = $"Wave {m_Wave}/{CurStageData.n_MaxWave}";
slider_wave.value = ((m_Wave - 1) / (float)CurStageData.n_MaxWave);
texts_money[2].text = $"Wave {(m_Wave > CurStageData.n_MaxWave ? CurStageData.n_MaxWave : m_Wave)}/{CurStageData.n_MaxWave}";
slider_wave.value = (m_Wave - 1) / (float)CurStageData.n_MaxWave;
t_hp.text = m_HP.ToString();
slider_exp.value = 0f;

View File

@ -1,5 +1,7 @@
using CodeStage.AntiCheat.ObscuredTypes;
using UnityEngine;
using static UnityEditor.PlayerSettings;
using static UnityEngine.Rendering.DebugUI.Table;
public class Projectile : MonoBehaviour
{
@ -10,7 +12,7 @@ public class Projectile : MonoBehaviour
Vector2 prevPos;
ObscuredInt m_bounceCount;
ProjectileTableData m_Data;
ProjectileData m_ProjectileData;
#region
ProjectileMgr owner;
@ -28,15 +30,20 @@ public class Projectile : MonoBehaviour
owner.Return(this);
// 이펙트 표시 필요
}
public ProjectileTableData Get_ProjectileTData() { return m_Data; }
public ProjectileTableData Get_ProjectileTData() { return m_ProjectileData.m_Data; }
#endregion
public void Set(int id)
public void Set(ProjectileData pd)
{
m_ProjectileData = pd;
transform.SetPositionAndRotation(m_ProjectileData.tf_Start.position, m_ProjectileData.tf_Start.rotation);
if (!m_ProjectileData.IsPC)
transform.eulerAngles = new Vector3(0f, 0f, 180f);
dir = transform.up.normalized;
m_Data = table_projectile.Ins.Get_Data(id);
m_bounceCount = m_Data.n_AttackBounceLimit;
m_bounceCount = m_ProjectileData.m_Data.n_AttackBounceLimit;
m_bounceCount.RandomizeCryptoKey();
}
@ -50,6 +57,8 @@ public class Projectile : MonoBehaviour
private void OnTriggerEnter2D(Collider2D collision)
{
if (!m_ProjectileData.IsPC && collision.tag == "Mob") return;
if (m_bounceCount <= 0)
{
Kill();
@ -123,3 +132,11 @@ public class Projectile : MonoBehaviour
}
}
}
public class ProjectileData
{
public ProjectileTableData m_Data;
public Transform tf_Start;
ObscuredBool _IsPC; public bool IsPC { get { return _IsPC; } set { _IsPC = value; _IsPC.RandomizeCryptoKey(); } }
ObscuredInt _Lv; public int Lv { get { return _Lv; } set { _Lv = value; _Lv.RandomizeCryptoKey(); } }
}

View File

@ -33,13 +33,13 @@ public class ProjectileMgr : MonoBehaviourSingletonTemplate<ProjectileMgr>
}
}
public Projectile Get(int projectileid, Transform tf)
public void Shoot_Projectile(ProjectileData pd)
{
var data = table_projectile.Ins.Get_Data(projectileid);
return Get(data.s_ProjectilePrefabs, tf.position, tf.rotation);
var proj = Get(pd.m_Data.s_ProjectilePrefabs);
proj.Set(pd);
}
public Projectile Get(string prefabPath, Vector3 pos, Quaternion rot)
public Projectile Get(string prefabPath)
{
if (!pools.TryGetValue(prefabPath, out Queue<Projectile> pool))
{
@ -49,7 +49,6 @@ public class ProjectileMgr : MonoBehaviourSingletonTemplate<ProjectileMgr>
Projectile p = pool.Count > 0 ? pool.Dequeue() : CreateExtra(prefabPath);
p.gameObject.SetActive(true);
p.transform.SetPositionAndRotation(pos, rot);
return p;
}