투사체 pool 확장
This commit is contained in:
parent
0fe1834b96
commit
392f3cd555
|
|
@ -18,5 +18,10 @@
|
|||
- 지그재그
|
||||
- 랜덤
|
||||
|
||||
몬스터 실드 구현
|
||||
- 갯수
|
||||
- 파괴 가능
|
||||
- 파괴 불가능
|
||||
|
||||
고찰
|
||||
- 에임을 마우스 찍은 곳으로 lookat 하면 안되나?
|
||||
|
|
@ -1 +1 @@
|
|||
[{"n_MonsterTypeID":"2001","e_MonsterType":"Monster","f_DefaultAttack":"10","f_DefaultHp":"40","n_DropExp":"1","e_UnityType":"Melee","f_AttackRange":"1.2","f_AttackDelay":"1.1","f_MoveSpeed":"1","e_MoveType":"Static","s_ProjectilePrefabs":"DefaultMeleeProjectile","s_MonsterPrefabPath":"2001","f_Scale":"0.15","e_ShieldType":"None","n_NormalShieldCount":"0","n_InvinityShieldCount":"0"},{"n_MonsterTypeID":"2002","e_MonsterType":"Monster","f_DefaultAttack":"20","f_DefaultHp":"60","n_DropExp":"1","e_UnityType":"Range","f_AttackRange":"5","f_AttackDelay":"2","f_MoveSpeed":"1.2","e_MoveType":"Static","s_ProjectilePrefabs":"DefaultRangeProjectile","s_MonsterPrefabPath":"2002","f_Scale":"0.15","e_ShieldType":"Static","n_NormalShieldCount":"1","n_InvinityShieldCount":"0"},{"n_MonsterTypeID":"2003","e_MonsterType":"Boss","f_DefaultAttack":"30","f_DefaultHp":"60","n_DropExp":"3","e_UnityType":"Range","f_AttackRange":"4.5","f_AttackDelay":"1.5","f_MoveSpeed":"1.2","e_MoveType":"Random","s_ProjectilePrefabs":"DefaultRangeProjectile","s_MonsterPrefabPath":"2003","f_Scale":"0.3","e_ShieldType":"Rotation","n_NormalShieldCount":"1","n_InvinityShieldCount":"1"},{"n_MonsterTypeID":"2004","e_MonsterType":"Monster","f_DefaultAttack":"10","f_DefaultHp":"40","n_DropExp":"1","e_UnityType":"Melee","f_AttackRange":"1.2","f_AttackDelay":"1.1","f_MoveSpeed":"1","e_MoveType":"Static","s_ProjectilePrefabs":"DefaultMeleeProjectile","s_MonsterPrefabPath":"2004","f_Scale":"0.15","e_ShieldType":"None","n_NormalShieldCount":"0","n_InvinityShieldCount":"0"},{"n_MonsterTypeID":"2005","e_MonsterType":"Monster","f_DefaultAttack":"20","f_DefaultHp":"60","n_DropExp":"1","e_UnityType":"Range","f_AttackRange":"5","f_AttackDelay":"2","f_MoveSpeed":"1.2","e_MoveType":"Static","s_ProjectilePrefabs":"DefaultRangeProjectile","s_MonsterPrefabPath":"2005","f_Scale":"0.15","e_ShieldType":"Static","n_NormalShieldCount":"1","n_InvinityShieldCount":"0"},{"n_MonsterTypeID":"2006","e_MonsterType":"Boss","f_DefaultAttack":"30","f_DefaultHp":"60","n_DropExp":"3","e_UnityType":"Range","f_AttackRange":"4.5","f_AttackDelay":"1.5","f_MoveSpeed":"1.2","e_MoveType":"Random","s_ProjectilePrefabs":"DefaultRangeProjectile","s_MonsterPrefabPath":"2006","f_Scale":"0.3","e_ShieldType":"Rotation","n_NormalShieldCount":"1","n_InvinityShieldCount":"1"}]
|
||||
[{"n_MonsterTypeID":"2001","e_MonsterType":"Monster","f_DefaultAttack":"10","f_DefaultHp":"40","n_DropExp":"1","e_UnityType":"Melee","f_AttackRange":"1.2","f_AttackDelay":"1.1","f_MoveSpeed":"1","e_MoveType":"Static","n_ProjectileID":"3101","s_MonsterPrefabPath":"2001","f_Scale":"0.15","e_ShieldType":"None","n_NormalShieldCount":"0","n_InvinityShieldCount":"0"},{"n_MonsterTypeID":"2002","e_MonsterType":"Monster","f_DefaultAttack":"20","f_DefaultHp":"60","n_DropExp":"1","e_UnityType":"Range","f_AttackRange":"5","f_AttackDelay":"2","f_MoveSpeed":"1.2","e_MoveType":"Static","n_ProjectileID":"3102","s_MonsterPrefabPath":"2002","f_Scale":"0.15","e_ShieldType":"Static","n_NormalShieldCount":"1","n_InvinityShieldCount":"0"},{"n_MonsterTypeID":"2003","e_MonsterType":"Boss","f_DefaultAttack":"30","f_DefaultHp":"60","n_DropExp":"3","e_UnityType":"Melee","f_AttackRange":"2","f_AttackDelay":"1.5","f_MoveSpeed":"1.2","e_MoveType":"Random","n_ProjectileID":"3101","s_MonsterPrefabPath":"2003","f_Scale":"0.3","e_ShieldType":"Rotation","n_NormalShieldCount":"1","n_InvinityShieldCount":"1"},{"n_MonsterTypeID":"2004","e_MonsterType":"Monster","f_DefaultAttack":"10","f_DefaultHp":"40","n_DropExp":"1","e_UnityType":"Melee","f_AttackRange":"1.2","f_AttackDelay":"1.1","f_MoveSpeed":"1","e_MoveType":"Static","n_ProjectileID":"3101","s_MonsterPrefabPath":"2004","f_Scale":"0.15","e_ShieldType":"None","n_NormalShieldCount":"0","n_InvinityShieldCount":"0"},{"n_MonsterTypeID":"2005","e_MonsterType":"Monster","f_DefaultAttack":"20","f_DefaultHp":"60","n_DropExp":"1","e_UnityType":"Range","f_AttackRange":"5","f_AttackDelay":"2","f_MoveSpeed":"1.2","e_MoveType":"Static","n_ProjectileID":"3102","s_MonsterPrefabPath":"2005","f_Scale":"0.15","e_ShieldType":"Static","n_NormalShieldCount":"1","n_InvinityShieldCount":"0"},{"n_MonsterTypeID":"2006","e_MonsterType":"Boss","f_DefaultAttack":"30","f_DefaultHp":"60","n_DropExp":"3","e_UnityType":"Range","f_AttackRange":"4.5","f_AttackDelay":"1.5","f_MoveSpeed":"1.2","e_MoveType":"Random","n_ProjectileID":"3102","s_MonsterPrefabPath":"2006","f_Scale":"0.3","e_ShieldType":"Rotation","n_NormalShieldCount":"1","n_InvinityShieldCount":"1"}]
|
||||
|
|
@ -1 +1 @@
|
|||
[]
|
||||
[{"n_ProjectileID":"3001","s_ProjectilePrefabs":"Projectile_Arrow","s_HitEffect":"","f_ProjectileSpeed":"2.6","f_AttackBounceLimit":"1","f_ProjectileDistance":"-1","n_ProjectileLife":"2","f_KnockbackDistance":"0.1","f_StunTime":"0","f_ExplosionRange":"0.5","f_ExplosionDamage":"0"},{"n_ProjectileID":"3101","s_ProjectilePrefabs":"Projectile_MobMelee","s_HitEffect":"","f_ProjectileSpeed":"3","f_AttackBounceLimit":"0","f_ProjectileDistance":"-1","n_ProjectileLife":"5","f_KnockbackDistance":"0","f_StunTime":"0","f_ExplosionRange":"0.5","f_ExplosionDamage":"0"},{"n_ProjectileID":"3102","s_ProjectilePrefabs":"Projectile_MobRange","s_HitEffect":"","f_ProjectileSpeed":"3","f_AttackBounceLimit":"0","f_ProjectileDistance":"-1","n_ProjectileLife":"5","f_KnockbackDistance":"0","f_StunTime":"0","f_ExplosionRange":"0","f_ExplosionDamage":"0"}]
|
||||
|
|
@ -1 +1 @@
|
|||
[{"n_UnitID":"1000","f_DefaultAttack":"100","n_DefaultHp":"500","f_AttackSpeed":"1.25","n_DefaultProjectileCount":"1","s_ProjectilePrefabs":"Projectile_Arrow","s_UnitPrefabPath":"DefaultUnit"}]
|
||||
[{"n_UnitID":"1001","f_DefaultAttack":"100","n_DefaultHp":"500","f_AttackSpeed":"1.25","n_DefaultProjectileCount":"1","n_ProjectileID":"3001","s_UnitPrefabPath":"DefaultUnit"}]
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 3cecf7a04a9b9f342ae4a41e50669494
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1 @@
|
|||
[{"n_MonsterTypeID":"2001","e_MonsterType":"Monster","f_DefaultAttack":"10","f_DefaultHp":"40","n_DropExp":"1","e_UnityType":"Melee","f_AttackRange":"1.2","f_AttackDelay":"1.1","f_MoveSpeed":"1","e_MoveType":"Static","n_ProjectileID":"3101","s_MonsterPrefabPath":"2001","f_Scale":"0.15","e_ShieldType":"None","n_NormalShieldCount":"0","n_InvinityShieldCount":"0"},{"n_MonsterTypeID":"2002","e_MonsterType":"Monster","f_DefaultAttack":"20","f_DefaultHp":"60","n_DropExp":"1","e_UnityType":"Range","f_AttackRange":"5","f_AttackDelay":"2","f_MoveSpeed":"1.2","e_MoveType":"Static","n_ProjectileID":"3102","s_MonsterPrefabPath":"2002","f_Scale":"0.15","e_ShieldType":"Static","n_NormalShieldCount":"1","n_InvinityShieldCount":"0"},{"n_MonsterTypeID":"2003","e_MonsterType":"Boss","f_DefaultAttack":"30","f_DefaultHp":"60","n_DropExp":"3","e_UnityType":"Melee","f_AttackRange":"2","f_AttackDelay":"1.5","f_MoveSpeed":"1.2","e_MoveType":"Random","n_ProjectileID":"3101","s_MonsterPrefabPath":"2003","f_Scale":"0.3","e_ShieldType":"Rotation","n_NormalShieldCount":"1","n_InvinityShieldCount":"1"},{"n_MonsterTypeID":"2004","e_MonsterType":"Monster","f_DefaultAttack":"10","f_DefaultHp":"40","n_DropExp":"1","e_UnityType":"Melee","f_AttackRange":"1.2","f_AttackDelay":"1.1","f_MoveSpeed":"1","e_MoveType":"Static","n_ProjectileID":"3101","s_MonsterPrefabPath":"2004","f_Scale":"0.15","e_ShieldType":"None","n_NormalShieldCount":"0","n_InvinityShieldCount":"0"},{"n_MonsterTypeID":"2005","e_MonsterType":"Monster","f_DefaultAttack":"20","f_DefaultHp":"60","n_DropExp":"1","e_UnityType":"Range","f_AttackRange":"5","f_AttackDelay":"2","f_MoveSpeed":"1.2","e_MoveType":"Static","n_ProjectileID":"3102","s_MonsterPrefabPath":"2005","f_Scale":"0.15","e_ShieldType":"Static","n_NormalShieldCount":"1","n_InvinityShieldCount":"0"},{"n_MonsterTypeID":"2006","e_MonsterType":"Boss","f_DefaultAttack":"30","f_DefaultHp":"60","n_DropExp":"3","e_UnityType":"Range","f_AttackRange":"4.5","f_AttackDelay":"1.5","f_MoveSpeed":"1.2","e_MoveType":"Random","n_ProjectileID":"3102","s_MonsterPrefabPath":"2006","f_Scale":"0.3","e_ShieldType":"Rotation","n_NormalShieldCount":"1","n_InvinityShieldCount":"1"}]
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 8e27583e2d6ce204c8af3336340e62f6
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1 @@
|
|||
[{"n_ProjectileID":"3001","s_ProjectilePrefabs":"Projectile_Arrow","s_HitEffect":"","s_ProjectileSpeed":"2.6","f_AttackBounceLimit":"1","f_ProjectileDistance":"-1","n_ProjectileLife":"2","f_KnockbackDistance":"0.1","f_StunTime":"0","f_ExplosionRange":"0.5","f_ExplosionDamage":"0"},{"n_ProjectileID":"3101","s_ProjectilePrefabs":"Projectile_MobMelee","s_HitEffect":"","s_ProjectileSpeed":"3","f_AttackBounceLimit":"0","f_ProjectileDistance":"-1","n_ProjectileLife":"5","f_KnockbackDistance":"0","f_StunTime":"0","f_ExplosionRange":"0.5","f_ExplosionDamage":"0"},{"n_ProjectileID":"3102","s_ProjectilePrefabs":"Projectile_MobRange","s_HitEffect":"","s_ProjectileSpeed":"3","f_AttackBounceLimit":"0","f_ProjectileDistance":"-1","n_ProjectileLife":"5","f_KnockbackDistance":"0","f_StunTime":"","f_ExplosionRange":"","f_ExplosionDamage":""}]
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: cbe637f7f3d3c8e449d61d5b3b12b51c
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1 @@
|
|||
[{"n_StageID":"10001","n_NextStage":"10002","s_StageMapPath":"stage/map1","n_StageName":"90001","n_WavePatternGroupID":"1001","n_MaxWave":"3","s_AppearMeleeMonsterID":"2001^2004","s_AppearRangeMonsterID":"2002^2005","s_AppearBossWave":"3","s_AppearBossMonsterID":"2003","n_DropItemId":"0","s_DropItemRate":"0%","n_StageClearGold":"100","n_StageClearExp":"3","n_DefaultEnemyAttack":"3","n_DefaultEnemyHp":"2","n_DefaultBossAttack":"3","n_DefaultBossHp":"2"},{"n_StageID":"10002","n_NextStage":"10003","s_StageMapPath":"stage/map2","n_StageName":"90002","n_WavePatternGroupID":"1001","n_MaxWave":"3","s_AppearMeleeMonsterID":"2001","s_AppearRangeMonsterID":"2002","s_AppearBossWave":"2^3","s_AppearBossMonsterID":"2003^2006","n_DropItemId":"0","s_DropItemRate":"0%","n_StageClearGold":"200","n_StageClearExp":"7","n_DefaultEnemyAttack":"7","n_DefaultEnemyHp":"6","n_DefaultBossAttack":"7","n_DefaultBossHp":"6"},{"n_StageID":"10003","n_NextStage":"10004","s_StageMapPath":"stage/map3","n_StageName":"90003","n_WavePatternGroupID":"1001","n_MaxWave":"3","s_AppearMeleeMonsterID":"2004","s_AppearRangeMonsterID":"2005","s_AppearBossWave":"3^5","s_AppearBossMonsterID":"2003^2006","n_DropItemId":"0","s_DropItemRate":"0%","n_StageClearGold":"300","n_StageClearExp":"10","n_DefaultEnemyAttack":"10","n_DefaultEnemyHp":"8","n_DefaultBossAttack":"10","n_DefaultBossHp":"8"},{"n_StageID":"10004","n_NextStage":"-1","s_StageMapPath":"stage/map4","n_StageName":"90004","n_WavePatternGroupID":"1002","n_MaxWave":"3","s_AppearMeleeMonsterID":"2001^2004","s_AppearRangeMonsterID":"2002^2005","s_AppearBossWave":"3","s_AppearBossMonsterID":"2006","n_DropItemId":"0","s_DropItemRate":"0%","n_StageClearGold":"400","n_StageClearExp":"15","n_DefaultEnemyAttack":"15","n_DefaultEnemyHp":"10","n_DefaultBossAttack":"15","n_DefaultBossHp":"10"}]
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 392af5bba8d636647b86b8647cf6718a
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1 @@
|
|||
[{"n_UnitID":"1000","f_DefaultAttack":"100","n_DefaultHp":"500","f_AttackSpeed":"1.25","n_DefaultProjectileCount":"1","n_ProjectileID":"3001","s_UnitPrefabPath":"DefaultUnit"}]
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: dd893c78f489e5142aeba8e4c593557a
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1 @@
|
|||
[{"n_PatternID":"1001","n_AppearWave":"1","n_AppearMeleeMonster":"10","n_AppearRangeMonster":"0","f_AppearDelay":"0.5","n_OverlapUnitCount":"1","f_NextWaveDelay":"3.5"},{"n_PatternID":"1001","n_AppearWave":"2","n_AppearMeleeMonster":"27","n_AppearRangeMonster":"4","f_AppearDelay":"0.35","n_OverlapUnitCount":"1","f_NextWaveDelay":"2.5"},{"n_PatternID":"1001","n_AppearWave":"3","n_AppearMeleeMonster":"40","n_AppearRangeMonster":"10","f_AppearDelay":"0.2","n_OverlapUnitCount":"2","f_NextWaveDelay":"2.5"},{"n_PatternID":"1002","n_AppearWave":"1","n_AppearMeleeMonster":"10","n_AppearRangeMonster":"0","f_AppearDelay":"0.5","n_OverlapUnitCount":"2","f_NextWaveDelay":"3"},{"n_PatternID":"1002","n_AppearWave":"2","n_AppearMeleeMonster":"27","n_AppearRangeMonster":"4","f_AppearDelay":"0.35","n_OverlapUnitCount":"2","f_NextWaveDelay":"3"},{"n_PatternID":"1002","n_AppearWave":"3","n_AppearMeleeMonster":"40","n_AppearRangeMonster":"10","f_AppearDelay":"0.2","n_OverlapUnitCount":"3","f_NextWaveDelay":"3"},{"n_PatternID":"1003","n_AppearWave":"1","n_AppearMeleeMonster":"10","n_AppearRangeMonster":"0","f_AppearDelay":"0.5","n_OverlapUnitCount":"2","f_NextWaveDelay":"3"},{"n_PatternID":"1003","n_AppearWave":"2","n_AppearMeleeMonster":"27","n_AppearRangeMonster":"4","f_AppearDelay":"0.35","n_OverlapUnitCount":"2","f_NextWaveDelay":"3"},{"n_PatternID":"1003","n_AppearWave":"3","n_AppearMeleeMonster":"40","n_AppearRangeMonster":"10","f_AppearDelay":"0.2","n_OverlapUnitCount":"3","f_NextWaveDelay":"3"}]
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 27e6b28fb65b80d4ebb98ee0ccf396b7
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
|
|
@ -33,7 +33,8 @@ public class AimArrowController : MonoBehaviour
|
|||
arrow.enabled = false;
|
||||
isAiming = false;
|
||||
|
||||
ProjectileMgr.Ins.Get(arrow.transform).Set();
|
||||
var unit = IngameMgr.Ins.Get_CurUnitTData();
|
||||
ProjectileMgr.Ins.Get(unit.n_ProjectileID, arrow.transform).Set(unit.n_ProjectileID);
|
||||
}
|
||||
|
||||
void UpdateArrow(Vector2 currentPos)
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
using System.Collections;
|
||||
using UnityEngine;
|
||||
|
||||
public enum eMobState { Move, Attack }
|
||||
|
|
@ -70,12 +71,12 @@ public class MobActor : MonoBehaviour
|
|||
|
||||
//m_Animator.speed = 2f;
|
||||
m_Animator.SetTrigger("att");
|
||||
|
||||
// 철책 or 플레이어 공격
|
||||
AttackFence();
|
||||
StartCoroutine(Co_AttackProjectile());
|
||||
}
|
||||
|
||||
void AttackFence()
|
||||
IEnumerator Co_AttackProjectile()
|
||||
{
|
||||
yield return new WaitForSeconds(1f);
|
||||
ProjectileMgr.Ins.Get(m_Data.n_ProjectileID, transform).Set(m_Data.n_ProjectileID);
|
||||
}
|
||||
}
|
||||
|
|
@ -3,7 +3,7 @@ using TMPro;
|
|||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class IngameMgr : MonoBehaviour
|
||||
public class IngameMgr : MonoBehaviourSingletonTemplate<IngameMgr>
|
||||
{
|
||||
[Header("UI")]
|
||||
public TextMeshProUGUI[] texts_money; // 0 코인, 1 아이템, 2 웨이브
|
||||
|
|
@ -18,13 +18,14 @@ public class IngameMgr : MonoBehaviour
|
|||
|
||||
int m_Wave, m_HP, m_Coin, m_Item, m_Lv, m_Exp;
|
||||
StageConfigTableData CurStageData;
|
||||
UnitTableData CurUnitData;
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
CurStageData = table_stageconfig.Ins.Get_Data(10001);
|
||||
var unitdata = table_unit.Ins.Get_Data(1000);
|
||||
CurUnitData = table_unit.Ins.Get_Data(1001);
|
||||
|
||||
m_HP = unitdata.n_DefaultHp;
|
||||
m_HP = CurUnitData.n_DefaultHp;
|
||||
m_Lv = m_Wave = 1;
|
||||
m_Exp = m_Coin = m_Item = 0;
|
||||
|
||||
|
|
@ -98,4 +99,7 @@ public class IngameMgr : MonoBehaviour
|
|||
Set_Texts();
|
||||
StartCoroutine(Co_MakeMob());
|
||||
}
|
||||
|
||||
public StageConfigTableData Get_CurStageTData() { return CurStageData; }
|
||||
public UnitTableData Get_CurUnitTData() { return CurUnitData; }
|
||||
}
|
||||
|
|
@ -1,25 +1,43 @@
|
|||
using CodeStage.AntiCheat.ObscuredTypes;
|
||||
using UnityEngine;
|
||||
|
||||
public class Projectile : MonoBehaviour
|
||||
{
|
||||
public float m_Speed = 12f;
|
||||
public int m_MaxBounce = 3;
|
||||
public float radius = 0.1f;
|
||||
|
||||
Vector2 dir;
|
||||
Vector2 prevPos;
|
||||
int bounceCount;
|
||||
ObscuredInt m_bounceCount;
|
||||
|
||||
ProjectileTableData m_Data;
|
||||
|
||||
#region 투사체 매니저
|
||||
ProjectileMgr owner;
|
||||
public void SetOwner(ProjectileMgr mgr) { owner = mgr; }
|
||||
void Kill() { owner.Return(this); }
|
||||
string prefabKey;
|
||||
|
||||
public void SetOwner(ProjectileMgr mgr, string key)
|
||||
{
|
||||
owner = mgr;
|
||||
prefabKey = key;
|
||||
}
|
||||
|
||||
public string GetPoolKey() { return prefabKey; }
|
||||
void Kill()
|
||||
{
|
||||
owner.Return(this);
|
||||
// 이펙트 표시 필요
|
||||
}
|
||||
public ProjectileTableData Get_ProjectileTData() { return m_Data; }
|
||||
#endregion
|
||||
|
||||
public void Set()
|
||||
public void Set(int id)
|
||||
{
|
||||
dir = transform.up.normalized;
|
||||
bounceCount = m_MaxBounce;
|
||||
|
||||
m_Data = table_projectile.Ins.Get_Data(id);
|
||||
m_bounceCount = m_Data.n_AttackBounceLimit;
|
||||
m_bounceCount.RandomizeCryptoKey();
|
||||
}
|
||||
|
||||
void Update()
|
||||
|
|
@ -32,7 +50,7 @@ public class Projectile : MonoBehaviour
|
|||
|
||||
private void OnTriggerEnter2D(Collider2D collision)
|
||||
{
|
||||
if (bounceCount <= 0)
|
||||
if (m_bounceCount <= 0)
|
||||
{
|
||||
Kill();
|
||||
return;
|
||||
|
|
@ -83,7 +101,8 @@ public class Projectile : MonoBehaviour
|
|||
|
||||
// 반사
|
||||
dir = Vector2.Reflect(dir, normal).normalized;
|
||||
bounceCount--;
|
||||
m_bounceCount--;
|
||||
m_bounceCount.RandomizeCryptoKey();
|
||||
|
||||
// 회전
|
||||
float angle = Mathf.Atan2(dir.y, dir.x) * Mathf.Rad2Deg - 90f;
|
||||
|
|
@ -102,6 +121,5 @@ public class Projectile : MonoBehaviour
|
|||
//ProjectileMgr.Ins.Get(transform.position, Quaternion.Euler(0, 0, Random.Range(-20, 20)) * dir);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -5,50 +5,72 @@ public class ProjectileMgr : MonoBehaviourSingletonTemplate<ProjectileMgr>
|
|||
{
|
||||
[Header("Pool Setting")]
|
||||
public Transform tf_parent;
|
||||
public Projectile projectilePrefab;
|
||||
public int poolSize = 50;
|
||||
public int defaultPoolSize = 10;
|
||||
|
||||
Queue<Projectile> pool = new Queue<Projectile>();
|
||||
// prefabPath -> pool
|
||||
Dictionary<string, Queue<Projectile>> pools = new Dictionary<string, Queue<Projectile>>();
|
||||
|
||||
protected override void Awake()
|
||||
public void InitPools()
|
||||
{
|
||||
base.Awake();
|
||||
InitPool();
|
||||
}
|
||||
var lst = table_projectile.Ins.Get_DataList();
|
||||
|
||||
void InitPool()
|
||||
{
|
||||
for (int i = 0; i < poolSize; i++)
|
||||
for (int i = 0; i < lst.Count; i++)
|
||||
{
|
||||
Projectile p = CreateExtra();
|
||||
p.gameObject.SetActive(false);
|
||||
pool.Enqueue(p);
|
||||
string prefabPath = lst[i].s_ProjectilePrefabs;
|
||||
|
||||
if (pools.ContainsKey(prefabPath))
|
||||
continue;
|
||||
|
||||
Queue<Projectile> q = new Queue<Projectile>();
|
||||
pools.Add(prefabPath, q);
|
||||
|
||||
for (int j = 0; j < defaultPoolSize; j++)
|
||||
{
|
||||
Projectile p = CreateExtra(prefabPath);
|
||||
p.gameObject.SetActive(false);
|
||||
q.Enqueue(p);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Projectile Get(Transform tf)
|
||||
public Projectile Get(int projectileid, Transform tf)
|
||||
{
|
||||
return Get(tf.position, tf.rotation);
|
||||
var data = table_projectile.Ins.Get_Data(projectileid);
|
||||
return Get(data.s_ProjectilePrefabs, tf.position, tf.rotation);
|
||||
}
|
||||
public Projectile Get(Vector3 pos, Quaternion q)
|
||||
|
||||
public Projectile Get(string prefabPath, Vector3 pos, Quaternion rot)
|
||||
{
|
||||
Projectile p = pool.Count > 0 ? pool.Dequeue() : CreateExtra();
|
||||
if (!pools.TryGetValue(prefabPath, out Queue<Projectile> pool))
|
||||
{
|
||||
Debug.LogError($"[ProjectileMgr] Pool not found : {prefabPath}");
|
||||
return null;
|
||||
}
|
||||
|
||||
Projectile p = pool.Count > 0 ? pool.Dequeue() : CreateExtra(prefabPath);
|
||||
p.gameObject.SetActive(true);
|
||||
p.transform.position = pos;
|
||||
p.transform.rotation = q;
|
||||
p.transform.SetPositionAndRotation(pos, rot);
|
||||
return p;
|
||||
}
|
||||
|
||||
public void Return(Projectile p)
|
||||
{
|
||||
p.gameObject.SetActive(false);
|
||||
|
||||
string key = p.Get_ProjectileTData().s_ProjectilePrefabs;
|
||||
if (!pools.TryGetValue(key, out Queue<Projectile> pool))
|
||||
{
|
||||
Debug.LogError($"[ProjectileMgr] Return failed. Pool not found : {key}");
|
||||
return;
|
||||
}
|
||||
|
||||
pool.Enqueue(p);
|
||||
}
|
||||
|
||||
Projectile CreateExtra()
|
||||
Projectile CreateExtra(string prefabPath)
|
||||
{
|
||||
Projectile p = Instantiate(projectilePrefab, tf_parent);
|
||||
p.SetOwner(this);
|
||||
Projectile p = DSUtil.Get_Clone<Projectile>(prefabPath, tf_parent);
|
||||
p.SetOwner(this, prefabPath);
|
||||
return p;
|
||||
}
|
||||
}
|
||||
|
|
@ -20,7 +20,8 @@ public class MonsterTableData : TableDataBase
|
|||
ObscuredFloat _AttackDelay; public float f_AttackDelay { get { return _AttackDelay; } set { _AttackDelay = value; _AttackDelay.RandomizeCryptoKey(); } }
|
||||
ObscuredFloat _MoveSpeed; public float f_MoveSpeed { get { return _MoveSpeed; } set { _MoveSpeed = value; _MoveSpeed.RandomizeCryptoKey(); } }
|
||||
public eMoveType e_MoveType;
|
||||
public string s_ProjectilePrefabs, s_MonsterPrefabPath;
|
||||
ObscuredInt _ProjectileID; public int n_ProjectileID { get { return _ProjectileID; } set { _ProjectileID = value; _ProjectileID.RandomizeCryptoKey(); } }
|
||||
public string s_MonsterPrefabPath;
|
||||
public float f_Scale;
|
||||
public eShieldType e_ShieldType;
|
||||
ObscuredInt _NormalShieldCount; public int n_NormalShieldCount { get { return _NormalShieldCount; } set { _NormalShieldCount = value; _NormalShieldCount.RandomizeCryptoKey(); } }
|
||||
|
|
|
|||
|
|
@ -4,10 +4,12 @@ using System.Collections.Generic;
|
|||
|
||||
public class ProjectileTableData : TableDataBase
|
||||
{
|
||||
public string s_ProjectilePrefabs, s_HitEffect, s_ProjectileSpeed, s_ProjectileLife;
|
||||
public string s_ProjectilePrefabs, s_HitEffect;
|
||||
ObscuredInt _ProjectileID; public int n_ProjectileID { get { return _ProjectileID; } set { _ProjectileID = value; _ProjectileID.RandomizeCryptoKey(); } }
|
||||
ObscuredFloat _AttackBounceLimit; public float f_AttackBounceLimit { get { return _AttackBounceLimit; } set { _AttackBounceLimit = value; _AttackBounceLimit.RandomizeCryptoKey(); } }
|
||||
ObscuredInt _AttackBounceLimit; public int n_AttackBounceLimit { get { return _AttackBounceLimit; } set { _AttackBounceLimit = value; _AttackBounceLimit.RandomizeCryptoKey(); } }
|
||||
ObscuredFloat _ProjectileDistance; public float f_ProjectileDistance { get { return _ProjectileDistance; } set { _ProjectileDistance = value; _ProjectileDistance.RandomizeCryptoKey(); } }
|
||||
ObscuredFloat _ProjectileSpeed; public float f_ProjectileSpeed { get { return _ProjectileSpeed; } set { _ProjectileSpeed = value; _ProjectileSpeed.RandomizeCryptoKey(); } }
|
||||
ObscuredInt _ProjectileLife; public int n_ProjectileLife { get { return _ProjectileLife; } set { _ProjectileLife = value; _ProjectileLife.RandomizeCryptoKey(); } }
|
||||
ObscuredFloat _KnockbackDistance; public float f_KnockbackDistance { get { return _KnockbackDistance; } set { _KnockbackDistance = value; _KnockbackDistance.RandomizeCryptoKey(); } }
|
||||
ObscuredFloat _StunTime; public float f_StunTime { get { return _StunTime; } set { _StunTime = value; _StunTime.RandomizeCryptoKey(); } }
|
||||
ObscuredFloat _ExplosionRange; public float f_ExplosionRange { get { return _ExplosionRange; } set { _ExplosionRange = value; _ExplosionRange.RandomizeCryptoKey(); } }
|
||||
|
|
@ -29,6 +31,11 @@ public class table_projectile : table_base
|
|||
protected override void Start()
|
||||
{
|
||||
tableDatas = JsonConvert.DeserializeObject<List<ProjectileTableData>>(json_last);
|
||||
for (int i = 0; i < tableDatas.Count; i++)
|
||||
{
|
||||
var temp = tableDatas[i];
|
||||
temp.s_ProjectilePrefabs = $"Projectile/{temp.s_ProjectilePrefabs}";
|
||||
}
|
||||
base.Start();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -11,9 +11,9 @@ public class UnitTableData : TableDataBase
|
|||
ObscuredInt _DefaultHp; public int n_DefaultHp { get { return _DefaultHp; } set { _DefaultHp = value; _DefaultHp.RandomizeCryptoKey(); } }
|
||||
|
||||
ObscuredFloat _AttackSpeed; public float f_AttackSpeed { get { return _AttackSpeed; } set { _AttackSpeed = value; _AttackSpeed.RandomizeCryptoKey(); } }
|
||||
|
||||
ObscuredInt _DefaultProjectileCount; public int n_DefaultProjectileCount { get { return _DefaultProjectileCount; } set { _DefaultProjectileCount = value; _DefaultProjectileCount.RandomizeCryptoKey(); } }
|
||||
public string s_ProjectilePrefabs, s_UnitPrefabPath;
|
||||
ObscuredInt _ProjectileID; public int n_ProjectileID { get { return _ProjectileID; } set { _ProjectileID = value; _ProjectileID.RandomizeCryptoKey(); } }
|
||||
public string s_UnitPrefabPath;
|
||||
}
|
||||
|
||||
public class table_unit : table_base
|
||||
|
|
|
|||
|
|
@ -44,7 +44,9 @@ public class TitleLoadingUI : MonoBehaviour
|
|||
slider_proc.value = 0f;
|
||||
// 테이블 로딩 기다리기
|
||||
while (!TableChecker.Ins.CheckAllLoad()) yield return null;
|
||||
//Add_ProcValue(0.7f); // 테이블 로딩 70%
|
||||
//Add_ProcValue(0.6f); // 테이블 로딩 60%
|
||||
ProjectileMgr.Ins.InitPools();
|
||||
//Add_ProcValue(0.1f); // 투사체 로딩 10%
|
||||
|
||||
//yield return StartCoroutine(Title_Mgr.Ins.Co_Check(Add_ProcValue));
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue