This commit is contained in:
김도환
2026-05-10 02:13:54 +09:00
parent e8ce7eb653
commit ee05d6eda9
23 changed files with 549 additions and 148 deletions

231
Assets/Prefabs/HpBar.prefab Normal file
View File

@@ -0,0 +1,231 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &44656911223875029
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 7867222899541067846}
- component: {fileID: 154264704736570930}
m_Layer: 0
m_Name: bg
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &7867222899541067846
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 44656911223875029}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 2, y: 0.5, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 2230193285998630056}
m_Father: {fileID: 6632233675126567313}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!212 &154264704736570930
SpriteRenderer:
serializedVersion: 2
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 44656911223875029}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 0
m_RayTraceProcedural: 0
m_RayTracingAccelStructBuildFlagsOverride: 0
m_RayTracingAccelStructBuildFlags: 1
m_SmallMeshCulling: 1
m_ForceMeshLod: -1
m_MeshLodSelectionBias: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: a97c105638bdf8b4a8650670310a4cd3, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 0
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_GlobalIlluminationMeshLod: 0
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_MaskInteraction: 0
m_Sprite: {fileID: 7482667652216324306, guid: 311925a002f4447b3a28927169b83ea6, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
m_Size: {x: 1, y: 1}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 1
m_SpriteSortPoint: 0
--- !u!1 &8660741472197541266
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 6632233675126567313}
- component: {fileID: 7735241326697819927}
m_Layer: 0
m_Name: HpBar
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &6632233675126567313
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8660741472197541266}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 1.5, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 7867222899541067846}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &7735241326697819927
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8660741472197541266}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 177f745ebb3c415e8e5c73b53c18636b, type: 3}
m_Name:
m_EditorClassIdentifier: Assembly-CSharp::Unicorn.HpBar
fill: {fileID: 9076800517195302650}
--- !u!1 &9076800517195302650
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2230193285998630056}
- component: {fileID: 538058977992172040}
m_Layer: 0
m_Name: fill
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &2230193285998630056
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 9076800517195302650}
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: 7867222899541067846}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!212 &538058977992172040
SpriteRenderer:
serializedVersion: 2
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 9076800517195302650}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 0
m_RayTraceProcedural: 0
m_RayTracingAccelStructBuildFlagsOverride: 0
m_RayTracingAccelStructBuildFlags: 1
m_SmallMeshCulling: 1
m_ForceMeshLod: -1
m_MeshLodSelectionBias: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: a97c105638bdf8b4a8650670310a4cd3, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 0
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_GlobalIlluminationMeshLod: 0
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 1
m_MaskInteraction: 0
m_Sprite: {fileID: 7482667652216324306, guid: 311925a002f4447b3a28927169b83ea6, type: 3}
m_Color: {r: 1, g: 0, b: 0, a: 1}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
m_Size: {x: 1, y: 1}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 1
m_SpriteSortPoint: 0

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 80d51bce958d6c94eb94d45ca7bf8c3f
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -29,7 +29,7 @@ Transform:
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -4.3426, y: 0.67107, z: 0}
m_LocalScale: {x: 0.05, y: 0.05, z: 0.05}
m_LocalScale: {x: 0.15, y: 0.15, z: 0.15}
m_ConstrainProportionsScale: 1
m_Children: []
m_Father: {fileID: 0}
@@ -123,7 +123,7 @@ BoxCollider2D:
m_CallbackLayers:
serializedVersion: 2
m_Bits: 4294967295
m_IsTrigger: 0
m_IsTrigger: 1
m_UsedByEffector: 0
m_CompositeOperation: 0
m_CompositeOrder: 0
@@ -151,4 +151,4 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: bdb9c585da578ee408fc4177ce2010e1, type: 3}
m_Name:
m_EditorClassIdentifier: Assembly-CSharp::Unicorn.Hitbox.UnicornHitbox
attackData: {fileID: 0}
hitboxData: {fileID: 11400000, guid: b6eb28167ca507f4097a624f0cc29d54, type: 2}

8
Assets/Resources.meta Normal file
View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 9cfa0bd0b4ddd3c4cb6f84c07d06871a
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -209,7 +209,7 @@ Transform:
m_GameObject: {fileID: 68822291}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -2.18, y: -0.93, z: 0}
m_LocalPosition: {x: -2.77, y: -0.45, z: 0}
m_LocalScale: {x: 0.25, y: 0.25, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
@@ -277,7 +277,7 @@ Rigidbody2D:
m_Mass: 1
m_LinearDamping: 0
m_AngularDamping: 0.05
m_GravityScale: 10
m_GravityScale: 5
m_Material: {fileID: 0}
m_IncludeLayers:
serializedVersion: 2
@@ -302,7 +302,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier: Assembly-CSharp::PlayerMovement
moveSpeed: 8
jumpForce: 20
jumpForce: 14
--- !u!114 &68822297
MonoBehaviour:
m_ObjectHideFlags: 0
@@ -328,7 +328,9 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 28098bcb033145e7aed508aa64877be6, type: 3}
m_Name:
m_EditorClassIdentifier: Assembly-CSharp::Unicorn.Game.Player.Player
health: 200
maxHealth: 10
health: 10
hpBarPrefab: {fileID: 8660741472197541266, guid: 80d51bce958d6c94eb94d45ca7bf8c3f, type: 3}
--- !u!1 &78098707
GameObject:
m_ObjectHideFlags: 0
@@ -480,109 +482,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: bdb9c585da578ee408fc4177ce2010e1, type: 3}
m_Name:
m_EditorClassIdentifier: Assembly-CSharp::Unicorn.Game.Hitbox.UnicornHitbox
attackData: {fileID: 11400000, guid: 67ddb0901f4c7754a9e47e5cf5cac286, type: 2}
--- !u!1 &194237975
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 194237979}
- component: {fileID: 194237978}
- component: {fileID: 194237977}
- component: {fileID: 194237976}
m_Layer: 5
m_Name: Canvas
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &194237976
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 194237975}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3}
m_Name:
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.GraphicRaycaster
m_IgnoreReversedGraphics: 1
m_BlockingObjects: 0
m_BlockingMask:
serializedVersion: 2
m_Bits: 4294967295
--- !u!114 &194237977
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 194237975}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3}
m_Name:
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.CanvasScaler
m_UiScaleMode: 0
m_ReferencePixelsPerUnit: 100
m_ScaleFactor: 1
m_ReferenceResolution: {x: 800, y: 600}
m_ScreenMatchMode: 0
m_MatchWidthOrHeight: 0
m_PhysicalUnit: 3
m_FallbackScreenDPI: 96
m_DefaultSpriteDPI: 96
m_DynamicPixelsPerUnit: 1
m_PresetInfoIsWorld: 0
--- !u!223 &194237978
Canvas:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 194237975}
m_Enabled: 1
serializedVersion: 3
m_RenderMode: 1
m_Camera: {fileID: 519420031}
m_PlaneDistance: 100
m_PixelPerfect: 0
m_ReceivesEvents: 1
m_OverrideSorting: 0
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_VertexColorAlwaysGammaSpace: 0
m_UseReflectionProbes: 0
m_AdditionalShaderChannelsFlag: 25
m_UpdateRectTransformForStandalone: 0
m_SortingLayerID: 0
m_SortingOrder: 0
m_TargetDisplay: 0
--- !u!224 &194237979
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 194237975}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0, y: 0, z: 0}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0, y: 0}
hitboxData: {fileID: 11400000, guid: 67ddb0901f4c7754a9e47e5cf5cac286, type: 2}
--- !u!1 &275882238
GameObject:
m_ObjectHideFlags: 0
@@ -607,7 +507,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 275882238}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
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
@@ -1044,7 +944,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: bdb9c585da578ee408fc4177ce2010e1, type: 3}
m_Name:
m_EditorClassIdentifier: Assembly-CSharp::Unicorn.Game.Hitbox.UnicornHitbox
attackData: {fileID: 11400000, guid: 67ddb0901f4c7754a9e47e5cf5cac286, type: 2}
hitboxData: {fileID: 11400000, guid: 67ddb0901f4c7754a9e47e5cf5cac286, type: 2}
--- !u!1 &619394800
GameObject:
m_ObjectHideFlags: 0
@@ -1220,7 +1120,8 @@ GameObject:
- component: {fileID: 1132170014}
- component: {fileID: 1132170013}
- component: {fileID: 1132170016}
m_Layer: 0
- component: {fileID: 1132170017}
m_Layer: 8
m_Name: Tuna
m_TagString: Untagged
m_Icon: {fileID: 0}
@@ -1253,7 +1154,7 @@ Rigidbody2D:
m_Interpolate: 0
m_SleepingMode: 1
m_CollisionDetection: 0
m_Constraints: 0
m_Constraints: 4
--- !u!212 &1132170014
SpriteRenderer:
serializedVersion: 2
@@ -1301,7 +1202,7 @@ SpriteRenderer:
m_GlobalIlluminationMeshLod: 0
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_SortingOrder: -1
m_MaskInteraction: 0
m_Sprite: {fileID: 21300000, guid: bf6d243c5f47f004fa08d89758c6bc0e, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
@@ -1322,8 +1223,8 @@ Transform:
m_GameObject: {fileID: 1132170011}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 4.3, y: -3.161, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_LocalPosition: {x: 5.31, y: -0.06, z: 0}
m_LocalScale: {x: 4, y: 4, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
@@ -1362,9 +1263,26 @@ CapsuleCollider2D:
m_UsedByEffector: 0
m_CompositeOperation: 0
m_CompositeOrder: 0
m_Offset: {x: -0.022632074, y: -0.077068515}
m_Size: {x: 1.9644431, y: 1.6619875}
m_Offset: {x: -0.022632053, y: 0.105049506}
m_Size: {x: 1.9644433, y: 1.297762}
m_Direction: 1
--- !u!114 &1132170017
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1132170011}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0f3078fdd3458bf459c4463291b07499, type: 3}
m_Name:
m_EditorClassIdentifier: Assembly-CSharp::Unicorn.Boss.Tuna
maxHealth: 200
health: 200
hpBarPrefab: {fileID: 8660741472197541266, guid: 80d51bce958d6c94eb94d45ca7bf8c3f, type: 3}
projContainer: {fileID: 1398908074}
phase1Proj: {fileID: 5921252368867129526, guid: 6db1d20b24524e6449e79fcc39f40401, type: 3}
--- !u!1 &1291505767
GameObject:
m_ObjectHideFlags: 0
@@ -1407,6 +1325,7 @@ GameObject:
serializedVersion: 6
m_Component:
- component: {fileID: 1398908074}
- component: {fileID: 1398908075}
m_Layer: 0
m_Name: Attack
m_TagString: Untagged
@@ -1429,6 +1348,18 @@ Transform:
m_Children: []
m_Father: {fileID: 1291505768}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1398908075
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1398908073}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 88e10741af6249658ff3e467495bf561, type: 3}
m_Name:
m_EditorClassIdentifier: Assembly-CSharp::Unicorn.Boss.AttackManager
--- !u!1 &1472544503
GameObject:
m_ObjectHideFlags: 0
@@ -1656,7 +1587,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: bdb9c585da578ee408fc4177ce2010e1, type: 3}
m_Name:
m_EditorClassIdentifier: Assembly-CSharp::Unicorn.Game.Hitbox.UnicornHitbox
attackData: {fileID: 11400000, guid: 67ddb0901f4c7754a9e47e5cf5cac286, type: 2}
hitboxData: {fileID: 11400000, guid: 67ddb0901f4c7754a9e47e5cf5cac286, type: 2}
--- !u!1 &1794068029
GameObject:
m_ObjectHideFlags: 0
@@ -1808,7 +1739,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: bdb9c585da578ee408fc4177ce2010e1, type: 3}
m_Name:
m_EditorClassIdentifier: Assembly-CSharp::Unicorn.Game.Hitbox.UnicornHitbox
attackData: {fileID: 11400000, guid: 67ddb0901f4c7754a9e47e5cf5cac286, type: 2}
hitboxData: {fileID: 11400000, guid: 67ddb0901f4c7754a9e47e5cf5cac286, type: 2}
--- !u!1660057539 &9223372036854775807
SceneRoots:
m_ObjectHideFlags: 0
@@ -1819,5 +1750,4 @@ SceneRoots:
- {fileID: 1523163457}
- {fileID: 1291505768}
- {fileID: 1132170015}
- {fileID: 194237979}
- {fileID: 1036095517}

View File

@@ -0,0 +1,49 @@
using System;
using System.Collections.Generic;
using Unicorn.Hitbox;
using Unity.Collections;
using Unity.Collections.LowLevel.Unsafe;
using UnityEngine;
namespace Unicorn.Boss
{
public class AttackManager: MonoBehaviour
{
private Dictionary<EntityId, float> _projMap;
private Dictionary<EntityId, UnicornHitbox> _projHitboxMap;
private const float Lifetime = 5f;
private void Start()
{
_projMap = new Dictionary<EntityId, float>();
_projHitboxMap = new Dictionary<EntityId, UnicornHitbox>();
}
private void FixedUpdate()
{
foreach (Transform o in transform)
{
var entityId = o.GetEntityId();
if (_projMap.TryAdd(entityId, 0f))
{
if (o.TryGetComponent(out UnicornHitbox hitbox))
_projHitboxMap.Add(entityId, hitbox);
}
if (o.gameObject.activeInHierarchy)
_projMap[entityId] += Time.fixedDeltaTime;
else continue;
if (_projMap[entityId] > Lifetime)
{
o.gameObject.SetActive(false);
_projMap[entityId] = 0f;
continue;
}
if (!_projHitboxMap.TryGetValue(entityId, out var unicornHitbox)) continue;
o.transform.Translate(o.right * (unicornHitbox.hitboxData.hitboxSpeed * Time.fixedDeltaTime), Space.World);
}
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 88e10741af6249658ff3e467495bf561
timeCreated: 1778331143

View File

@@ -1,8 +1,8 @@
using System.Collections;
using System.Collections.Generic;
using DG.Tweening;
using Unicorn.Hitbox;
using UnityEngine;
using NotImplementedException = System.NotImplementedException;
namespace Unicorn.Boss
{
@@ -15,6 +15,7 @@ namespace Unicorn.Boss
private UnicornPhase _unicornPhase = UnicornPhase.Start;
private Queue<GameObject> _p1Ps = new Queue<GameObject>();
private SpriteRenderer _renderer;
private const float P1PC = 12;
public Transform projContainer;
@@ -23,14 +24,17 @@ namespace Unicorn.Boss
private void Start()
{
_renderer = GetComponent<SpriteRenderer>();
StartCoroutine(Started());
base.Start();
}
private IEnumerator Started()
{
while (_p1Ps.Count < 50)
const float target = 360*5/P1PC;
while (_p1Ps.Count < target)
{
for (var i = 0; i < 5 && _p1Ps.Count < 50; i++) //프레임당 5개씩 생성
for (var i = 0; i < 5 && _p1Ps.Count < target; i++) //프레임당 5개씩 생성
{
var instantiate = Instantiate(phase1Proj, projContainer);
_p1Ps.Enqueue(instantiate);
@@ -46,26 +50,52 @@ namespace Unicorn.Boss
}
// 수정된 Phase1 로직
private IEnumerator Phase1()
{
_unicornPhase = UnicornPhase.P1;
for (int i = 0; i < 360 / P1PC; i++)
float angleStep = 360f / P1PC; // 각도 간격 (30도)
for (int i = 0; i < P1PC; i++)
{
var dequeue = _p1Ps.Dequeue();
dequeue.SetActive(true);
dequeue.transform.position = transform.position;
var rotationEulerAngles = transform.rotation.eulerAngles;
rotationEulerAngles.z += (360 / P1PC) * i;
dequeue.transform.rotation = Quaternion.Euler(rotationEulerAngles);
float targetAngle = transform.rotation.eulerAngles.z + (angleStep * i);
dequeue.transform.rotation = Quaternion.Euler(0, 0, targetAngle);
_p1Ps.Enqueue(dequeue);
yield return new WaitForSeconds(.2f);
}
yield return new WaitForSeconds(5);
yield return new WaitForSeconds(1);
StartCoroutine(Phase1());
}
protected override void OnKnockback(DamageInfo info)
{
//No KnockBack
}
protected override void OnDeath()
{
transform.DOScale(0f, 3f).SetEase(Ease.Linear).OnComplete(() =>
{
gameObject.SetActive(false);
base.OnDeath();
});
}
protected override void OnDamaged(DamageInfo info)
{
StopCoroutine(HitColor());
StartCoroutine(HitColor());
base.OnDamaged(info);
}
private IEnumerator HitColor()
{
_renderer.color = new Color(1f, 0.8f, 0.8f);
yield return new WaitForSeconds(0.5f);
_renderer.color = Color.white;
}
}
}

View File

@@ -0,0 +1,10 @@
using UnityEngine;
namespace Unicorn
{
public class GameManager: MonoBehaviour
{
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: cc10e4b8623544638c8e15879ff85de7
timeCreated: 1778342698

View File

@@ -4,15 +4,15 @@ namespace Unicorn.Hitbox
{
public class UnicornHitbox : MonoBehaviour
{
public UnicornAttackDataSObj attackData;
public UnicornHitboxDataSObj hitboxData;
private void OnTriggerEnter2D(Collider2D other)
{
if (!other.TryGetComponent(out LivingEntity target)) return;
var info = new DamageInfo
{
Damage = attackData.damage,
KnockbackForce = attackData.knockbackForce,
Damage = hitboxData.damage,
KnockbackForce = hitboxData.knockbackForce,
HitPoint = transform.position
};

View File

@@ -3,9 +3,10 @@
namespace Unicorn.Hitbox
{
[CreateAssetMenu(fileName = "NewAttackData", menuName = "Unicorn/AttackData")]
public class UnicornAttackDataSObj: ScriptableObject
public class UnicornHitboxDataSObj: ScriptableObject
{
public float damage;
public float knockbackForce;
public float hitboxSpeed;
}
}

View File

@@ -0,0 +1,31 @@
using System;
using UnityEngine;
namespace Unicorn
{
public class HpBar : MonoBehaviour
{
private LivingEntity _parent;
public GameObject fill;
private void Start()
{
if (!transform.parent.TryGetComponent(out _parent))
{
gameObject.SetActive(false);
return;
}
UpdateHealth();
}
public void UpdateHealth()
{
var scale = Math.Max(_parent.health, 0f) / _parent.maxHealth;
fill.transform.localScale = new Vector3(scale, 1, 1);
fill.transform.localPosition = new Vector3((scale-1) / 2, 0, 0);
//1 -> 0
//0 -> -0.5
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 177f745ebb3c415e8e5c73b53c18636b

View File

@@ -5,21 +5,18 @@ namespace Unicorn
{
public partial class LivingEntity : MonoBehaviour
{
public float maxHealth = 20.0f;
public float health = 20.0f;
public GameObject hpBarPrefab;
private Rigidbody2D Rb { get; set; }
private bool _invulnerable = false;
private HpBar _hpBar;
private void Start()
protected void Start()
{
Rb = TryGetComponent(out Rigidbody2D rb) ? rb : null;
}
private void OnTriggerEnter2D(Collider2D other)
{
if (Rb == null) return;
var transformPosition = other.transform.position - transform.position;
Rb.linearVelocity = Vector2.zero;
Rb.AddForce(transformPosition.normalized * health, ForceMode2D.Impulse);
var hpBar = Instantiate(hpBarPrefab, transform);
hpBar.TryGetComponent(out _hpBar);
}
public void Damage(DamageInfo info)
@@ -27,6 +24,7 @@ namespace Unicorn
if (_invulnerable) return;
health -= info.Damage;
OnDamaged(info);
OnKnockback(info);
if (health <= 0.0f) OnDeath();
}
@@ -34,10 +32,14 @@ namespace Unicorn
protected virtual void OnDeath() { }
protected virtual void OnDamaged(DamageInfo info) { }
protected virtual void OnDamaged(DamageInfo info)
{
if (_hpBar) _hpBar.UpdateHealth();
}
protected virtual void OnKnockback(DamageInfo info)
{
var dir = transform.position - info.HitPoint;
Rb.AddForce(dir.normalized * info.KnockbackForce, ForceMode2D.Impulse);
}

View File

@@ -8,11 +8,13 @@ namespace Unicorn.Player
protected override void OnDamaged(DamageInfo info)
{
Debug.Log(health);
base.OnDamaged(info);
}
protected override void OnDeath()
{
Debug.Log("주것서영.");
base.OnDeath();
}
}
}

View File

@@ -9,6 +9,7 @@ namespace Unicorn.Player
{
public GameObject attackHitbox;
private UnicornInputSystem _unicornInput;
private bool _attackAvailable = true;
private void Start()
{
_unicornInput = UnicornInput.Unicorn;
@@ -22,14 +23,18 @@ namespace Unicorn.Player
private void Attack(InputAction.CallbackContext obj)
{
if (!_attackAvailable) return;
StartCoroutine(OnAttack());
}
private IEnumerator OnAttack()
{
_attackAvailable = false;
attackHitbox.SetActive(true);
yield return new WaitForSeconds(0.5f);
attackHitbox.SetActive(false);
yield return new WaitForSeconds(0.1f);
_attackAvailable = true;
}
}
}

View File

@@ -12,5 +12,6 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 4de4d4a74d5b4258863a8173560a93ab, type: 3}
m_Name: ExampleAD
m_EditorClassIdentifier: Assembly-CSharp::Unicorn.Game.Hitbox.UnicornAttackDataSO
damage: 3
damage: 10
knockbackForce: 15
hitboxSpeed: 0

View File

@@ -13,4 +13,5 @@ MonoBehaviour:
m_Name: TunaP1
m_EditorClassIdentifier: Assembly-CSharp::Unicorn.Hitbox.UnicornAttackDataSObj
damage: 1
knockbackForce: 5
knockbackForce: 15
hitboxSpeed: 2

52
Assets/Sprites/s.htm Normal file

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: db5d2a87ae2b39e45ad3ded7bd1347f1
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: b22d539ab98d7e64a9e2c0bbd81f8a3f
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -581,7 +581,25 @@ PlayerSettings:
webGLCloseOnQuit: 0
webWasm2023: 0
webEnableSubmoduleStrippingCompatibility: 0
scriptingDefineSymbols: {}
scriptingDefineSymbols:
Android: DOTWEEN
EmbeddedLinux: DOTWEEN
GameCoreScarlett: DOTWEEN
GameCoreXboxOne: DOTWEEN
Kepler: DOTWEEN
LinuxHeadlessSimulation: DOTWEEN
Nintendo Switch: DOTWEEN
Nintendo Switch 2: DOTWEEN
PS4: DOTWEEN
PS5: DOTWEEN
QNX: DOTWEEN
Standalone: DOTWEEN
VisionOS: DOTWEEN
WebGL: DOTWEEN
Windows Store Apps: DOTWEEN
XboxOne: DOTWEEN
iPhone: DOTWEEN
tvOS: DOTWEEN
additionalCompilerArguments: {}
platformArchitecture: {}
scriptingBackend: