투사체 pool

This commit is contained in:
Ino 2026-01-12 12:23:48 +09:00
parent 134a94bb9a
commit ca36369022
8 changed files with 473 additions and 26 deletions

View File

@ -626,7 +626,6 @@ MonoBehaviour:
m_EditorClassIdentifier: m_EditorClassIdentifier:
arrow: {fileID: 7666490936302876945} arrow: {fileID: 7666490936302876945}
m_AngleSpeed: 5 m_AngleSpeed: 5
projectilePrefab: {fileID: 6506108141890977998, guid: 1432f0b0801152b43a2f86aa07a8fe0b, type: 3}
projectileParent: {fileID: 0} projectileParent: {fileID: 0}
--- !u!223 &5978298300487608438 --- !u!223 &5978298300487608438
Canvas: Canvas:

View File

@ -17336,6 +17336,198 @@ PrefabInstance:
serializedVersion: 3 serializedVersion: 3
m_TransformParent: {fileID: 901909686} m_TransformParent: {fileID: 901909686}
m_Modifications: m_Modifications:
- target: {fileID: 351787396953488355, guid: 7a72290f58c260649a424bb4dd1d8726, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 351787396953488355, guid: 7a72290f58c260649a424bb4dd1d8726, type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 351787396953488355, guid: 7a72290f58c260649a424bb4dd1d8726, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 351787396953488355, guid: 7a72290f58c260649a424bb4dd1d8726, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 351787397989201312, guid: 7a72290f58c260649a424bb4dd1d8726, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 351787397989201312, guid: 7a72290f58c260649a424bb4dd1d8726, type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 351787397989201312, guid: 7a72290f58c260649a424bb4dd1d8726, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 351787397989201312, guid: 7a72290f58c260649a424bb4dd1d8726, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1467771610490817847, guid: 7a72290f58c260649a424bb4dd1d8726, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1467771610490817847, guid: 7a72290f58c260649a424bb4dd1d8726, type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1467771610490817847, guid: 7a72290f58c260649a424bb4dd1d8726, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1467771610490817847, guid: 7a72290f58c260649a424bb4dd1d8726, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2027362653857723309, guid: 7a72290f58c260649a424bb4dd1d8726, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2027362653857723309, guid: 7a72290f58c260649a424bb4dd1d8726, type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2027362653857723309, guid: 7a72290f58c260649a424bb4dd1d8726, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2027362653857723309, guid: 7a72290f58c260649a424bb4dd1d8726, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2775089715950143664, guid: 7a72290f58c260649a424bb4dd1d8726, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2775089715950143664, guid: 7a72290f58c260649a424bb4dd1d8726, type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2775089715950143664, guid: 7a72290f58c260649a424bb4dd1d8726, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2775089715950143664, guid: 7a72290f58c260649a424bb4dd1d8726, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3034941298722984408, guid: 7a72290f58c260649a424bb4dd1d8726, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3034941298722984408, guid: 7a72290f58c260649a424bb4dd1d8726, type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3034941298722984408, guid: 7a72290f58c260649a424bb4dd1d8726, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3034941298722984408, guid: 7a72290f58c260649a424bb4dd1d8726, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3217378376239936541, guid: 7a72290f58c260649a424bb4dd1d8726, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3217378376239936541, guid: 7a72290f58c260649a424bb4dd1d8726, type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3217378376239936541, guid: 7a72290f58c260649a424bb4dd1d8726, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3217378376239936541, guid: 7a72290f58c260649a424bb4dd1d8726, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3851091814487837347, guid: 7a72290f58c260649a424bb4dd1d8726, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3851091814487837347, guid: 7a72290f58c260649a424bb4dd1d8726, type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3851091814487837347, guid: 7a72290f58c260649a424bb4dd1d8726, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3851091814487837347, guid: 7a72290f58c260649a424bb4dd1d8726, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4111377604873454816, guid: 7a72290f58c260649a424bb4dd1d8726, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4111377604873454816, guid: 7a72290f58c260649a424bb4dd1d8726, type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4111377604873454816, guid: 7a72290f58c260649a424bb4dd1d8726, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4111377604873454816, guid: 7a72290f58c260649a424bb4dd1d8726, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4111377605057742992, guid: 7a72290f58c260649a424bb4dd1d8726, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4111377605057742992, guid: 7a72290f58c260649a424bb4dd1d8726, type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4111377605057742992, guid: 7a72290f58c260649a424bb4dd1d8726, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4111377605057742992, guid: 7a72290f58c260649a424bb4dd1d8726, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4111377605223402641, guid: 7a72290f58c260649a424bb4dd1d8726, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4111377605223402641, guid: 7a72290f58c260649a424bb4dd1d8726, type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4111377605223402641, guid: 7a72290f58c260649a424bb4dd1d8726, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4111377605223402641, guid: 7a72290f58c260649a424bb4dd1d8726, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4111377605604120026, guid: 7a72290f58c260649a424bb4dd1d8726, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4111377605604120026, guid: 7a72290f58c260649a424bb4dd1d8726, type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4111377605604120026, guid: 7a72290f58c260649a424bb4dd1d8726, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4111377605604120026, guid: 7a72290f58c260649a424bb4dd1d8726, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4111377606588400904, guid: 7a72290f58c260649a424bb4dd1d8726, type: 3} - target: {fileID: 4111377606588400904, guid: 7a72290f58c260649a424bb4dd1d8726, type: 3}
propertyPath: m_Pivot.x propertyPath: m_Pivot.x
value: 0.5 value: 0.5
@ -17428,6 +17620,134 @@ PrefabInstance:
propertyPath: m_AnchorMax.y propertyPath: m_AnchorMax.y
value: 0 value: 0
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 4111377606646784701, guid: 7a72290f58c260649a424bb4dd1d8726, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4111377606646784701, guid: 7a72290f58c260649a424bb4dd1d8726, type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4111377606646784701, guid: 7a72290f58c260649a424bb4dd1d8726, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4111377606646784701, guid: 7a72290f58c260649a424bb4dd1d8726, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4241219922751532992, guid: 7a72290f58c260649a424bb4dd1d8726, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4241219922751532992, guid: 7a72290f58c260649a424bb4dd1d8726, type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4241219922751532992, guid: 7a72290f58c260649a424bb4dd1d8726, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4241219922751532992, guid: 7a72290f58c260649a424bb4dd1d8726, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4330008501081147663, guid: 7a72290f58c260649a424bb4dd1d8726, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4330008501081147663, guid: 7a72290f58c260649a424bb4dd1d8726, type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4330008501081147663, guid: 7a72290f58c260649a424bb4dd1d8726, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4330008501081147663, guid: 7a72290f58c260649a424bb4dd1d8726, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5691718172133534467, guid: 7a72290f58c260649a424bb4dd1d8726, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5691718172133534467, guid: 7a72290f58c260649a424bb4dd1d8726, type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5691718172133534467, guid: 7a72290f58c260649a424bb4dd1d8726, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5691718172133534467, guid: 7a72290f58c260649a424bb4dd1d8726, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5961969503056597898, guid: 7a72290f58c260649a424bb4dd1d8726, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5961969503056597898, guid: 7a72290f58c260649a424bb4dd1d8726, type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5961969503056597898, guid: 7a72290f58c260649a424bb4dd1d8726, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5961969503056597898, guid: 7a72290f58c260649a424bb4dd1d8726, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6093049785316884920, guid: 7a72290f58c260649a424bb4dd1d8726, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6093049785316884920, guid: 7a72290f58c260649a424bb4dd1d8726, type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6093049785316884920, guid: 7a72290f58c260649a424bb4dd1d8726, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6093049785316884920, guid: 7a72290f58c260649a424bb4dd1d8726, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6715526188961711891, guid: 7a72290f58c260649a424bb4dd1d8726, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6715526188961711891, guid: 7a72290f58c260649a424bb4dd1d8726, type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6715526188961711891, guid: 7a72290f58c260649a424bb4dd1d8726, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6715526188961711891, guid: 7a72290f58c260649a424bb4dd1d8726, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7053290558194657676, guid: 7a72290f58c260649a424bb4dd1d8726, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7053290558194657676, guid: 7a72290f58c260649a424bb4dd1d8726, type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7053290558194657676, guid: 7a72290f58c260649a424bb4dd1d8726, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7053290558194657676, guid: 7a72290f58c260649a424bb4dd1d8726, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7296985114498065767, guid: 7a72290f58c260649a424bb4dd1d8726, type: 3} - target: {fileID: 7296985114498065767, guid: 7a72290f58c260649a424bb4dd1d8726, type: 3}
propertyPath: m_AnchorMax.x propertyPath: m_AnchorMax.x
value: 0 value: 0
@ -17436,6 +17756,54 @@ PrefabInstance:
propertyPath: m_AnchorMax.y propertyPath: m_AnchorMax.y
value: 0 value: 0
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 8473443759915544516, guid: 7a72290f58c260649a424bb4dd1d8726, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8473443759915544516, guid: 7a72290f58c260649a424bb4dd1d8726, type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8473443759915544516, guid: 7a72290f58c260649a424bb4dd1d8726, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8473443759915544516, guid: 7a72290f58c260649a424bb4dd1d8726, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8809062110974703447, guid: 7a72290f58c260649a424bb4dd1d8726, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8809062110974703447, guid: 7a72290f58c260649a424bb4dd1d8726, type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8809062110974703447, guid: 7a72290f58c260649a424bb4dd1d8726, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8809062110974703447, guid: 7a72290f58c260649a424bb4dd1d8726, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 9045579651515305713, guid: 7a72290f58c260649a424bb4dd1d8726, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 9045579651515305713, guid: 7a72290f58c260649a424bb4dd1d8726, type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 9045579651515305713, guid: 7a72290f58c260649a424bb4dd1d8726, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 9045579651515305713, guid: 7a72290f58c260649a424bb4dd1d8726, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: [] m_RemovedComponents: []
m_RemovedGameObjects: [] m_RemovedGameObjects: []
m_AddedGameObjects: [] m_AddedGameObjects: []
@ -86580,6 +86948,11 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 368788154} m_GameObject: {fileID: 368788154}
m_CullTransparentMesh: 1 m_CullTransparentMesh: 1
--- !u!224 &368806902 stripped
RectTransform:
m_CorrespondingSourceObject: {fileID: 5061678075927086196, guid: 7a72290f58c260649a424bb4dd1d8726, type: 3}
m_PrefabInstance: {fileID: 73956442}
m_PrefabAsset: {fileID: 0}
--- !u!1 &369417069 --- !u!1 &369417069
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -293871,6 +294244,54 @@ MonoBehaviour:
m_OnValueChanged: m_OnValueChanged:
m_PersistentCalls: m_PersistentCalls:
m_Calls: [] m_Calls: []
--- !u!1 &1293320784
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1293320786}
- component: {fileID: 1293320785}
m_Layer: 0
m_Name: Mgr
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &1293320785
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1293320784}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: ab49994372de82649878bfdb8faf3b90, type: 3}
m_Name:
m_EditorClassIdentifier:
go_child: {fileID: 0}
tf_parent: {fileID: 368806902}
projectilePrefab: {fileID: 5283165188844738288, guid: 1432f0b0801152b43a2f86aa07a8fe0b, type: 3}
poolSize: 10
--- !u!4 &1293320786
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1293320784}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1293420715 --- !u!1 &1293420715
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -494797,3 +495218,4 @@ SceneRoots:
- {fileID: 519420032} - {fileID: 519420032}
- {fileID: 1571370885} - {fileID: 1571370885}
- {fileID: 11995857} - {fileID: 11995857}
- {fileID: 1293320786}

View File

@ -5,7 +5,6 @@ public class AimArrowController : MonoBehaviour
{ {
public Image arrow; public Image arrow;
public float m_AngleSpeed = 1.5f; public float m_AngleSpeed = 1.5f;
public GameObject projectilePrefab;
public Transform projectileParent; public Transform projectileParent;
Vector2 startPos; Vector2 startPos;
@ -35,7 +34,7 @@ public class AimArrowController : MonoBehaviour
arrow.enabled = false; arrow.enabled = false;
isAiming = false; isAiming = false;
var proj = DSUtil.Get_Clone<Projectile>(projectilePrefab, projectileParent); var proj = ProjectileMgr.Ins.Get();
proj.transform.position = arrow.transform.position; proj.transform.position = arrow.transform.position;
proj.transform.rotation = arrow.transform.rotation; proj.transform.rotation = arrow.transform.rotation;
proj.Set(); proj.Set();

View File

@ -31,7 +31,6 @@ public class AimController : MonoBehaviour
Vector2 endPos = Camera.main.ScreenToWorldPoint(Input.mousePosition); Vector2 endPos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
Vector2 shootDir = (endPos - startPos).normalized; Vector2 shootDir = (endPos - startPos).normalized;
GetComponent<Shooter>().Shoot(shootDir);
line.enabled = false; line.enabled = false;
isAiming = false; isAiming = false;
} }

View File

@ -1,19 +0,0 @@
using UnityEngine;
public class Shooter : MonoBehaviour
{
public GameObject projectilePrefab;
public float shootPower = 10f;
public void Shoot(Vector2 dir)
{
GameObject proj = Instantiate(
projectilePrefab,
transform.position,
Quaternion.identity
);
Rigidbody2D rb = proj.GetComponent<Rigidbody2D>();
rb.linearVelocity = dir * shootPower;
}
}

View File

@ -1,2 +0,0 @@
fileFormatVersion: 2
guid: 2c841fc89245f2344962b3dd0b85a4b8

View File

@ -10,6 +10,11 @@ public class Projectile : MonoBehaviour
Vector2 prevPos; Vector2 prevPos;
int bounceCount; int bounceCount;
#region
ProjectileMgr owner;
public void SetOwner(ProjectileMgr mgr) { owner = mgr; }
void Kill() { owner.Return(this); }
#endregion
public void Set() public void Set()
{ {
@ -29,7 +34,7 @@ public class Projectile : MonoBehaviour
{ {
if (bounceCount <= 0) if (bounceCount <= 0)
{ {
gameObject.SetActive(false); Kill();
return; return;
} }

View File

@ -1,4 +1,48 @@
using System.Collections.Generic;
using UnityEngine;
public class ProjectileMgr : MonoBehaviourSingletonTemplate<ProjectileMgr> public class ProjectileMgr : MonoBehaviourSingletonTemplate<ProjectileMgr>
{ {
[Header("Pool Setting")]
public Transform tf_parent;
public Projectile projectilePrefab;
public int poolSize = 50;
Queue<Projectile> pool = new Queue<Projectile>();
protected override void Awake()
{
base.Awake();
InitPool();
}
void InitPool()
{
for (int i = 0; i < poolSize; i++)
{
Projectile p = CreateExtra();
p.gameObject.SetActive(false);
pool.Enqueue(p);
}
}
public Projectile Get()
{
Projectile p = pool.Count > 0 ? pool.Dequeue() : CreateExtra();
p.gameObject.SetActive(true);
return p;
}
public void Return(Projectile p)
{
p.gameObject.SetActive(false);
pool.Enqueue(p);
}
Projectile CreateExtra()
{
Projectile p = Instantiate(projectilePrefab, tf_parent);
p.SetOwner(this);
return p;
}
} }