From d17553418a7a6eff0b720c3678740407a25a52ac Mon Sep 17 00:00:00 2001 From: Ben Oukhanov Date: Sun, 10 Nov 2024 23:29:13 +0200 Subject: [PATCH] feat(maple-fighters): add player character stats Player's character stats: - Level (and Character Name) - Health - Mana - Experience Points Also add player dead state. --- .../Resources/Game/Characters/Archer.prefab | 14 + .../Resources/Game/Characters/Knight.prefab | 14 + .../Resources/Game/Characters/Wizard.prefab | 14 + .../Resources/Game/Entities/BlueSnail.prefab | 1 + .../Resources/Game/Entities/Mushroom.prefab | 1 + .../Resources/UI/ChatWindow.prefab | 2 +- .../Resources/UI/PlayerDataWindow.prefab | 672 ++++++++++++++++++ .../Resources/UI/PlayerDataWindow.prefab.meta | 7 + .../UI/PlayerExperiencePointsBar.prefab | 411 +++++++++++ .../UI/PlayerExperiencePointsBar.prefab.meta | 7 + .../Gameplay/Creator/GameSystemsCreator.cs | 2 + .../Gameplay/Map/Objects/Mob/MobBehaviour.cs | 10 + .../Behaviours/PlayerAttackedBehaviour.cs | 8 +- .../Player/Controller/PlayerController.cs | 1 + .../Player/Controller/PlayerStateAnimator.cs | 2 + .../Player/Controller/PlayerStates.cs | 5 + .../Controller/States/PlayerDeadState.cs | 28 + .../Controller/States/PlayerDeadState.cs.meta | 11 + .../Scripts/Gameplay/Player/Data.meta | 8 + .../Gameplay/Player/Data/PlayerHealth.cs | 81 +++ .../Gameplay/Player/Data/PlayerHealth.cs.meta | 11 + .../Scripts/Services/UserMetadata.cs | 41 ++ .../Maple Fighters/Scripts/UI/PlayerData.meta | 8 + .../Scripts/UI/PlayerData/Controller.meta | 8 + .../Controller/PlayerDataController.cs | 105 +++ .../Controller/PlayerDataController.cs.meta | 11 + .../Scripts/UI/PlayerData/Window.meta | 8 + .../UI/PlayerData/Window/IPlayerDataView.cs | 13 + .../PlayerData/Window/IPlayerDataView.cs.meta | 11 + .../Window/IPlayerExperiencePointsView.cs | 11 + .../IPlayerExperiencePointsView.cs.meta | 11 + .../UI/PlayerData/Window/PlayerDataWindow.cs | 64 ++ .../Window/PlayerDataWindow.cs.meta | 11 + .../Window/PlayerExperiencePointsBar.cs | 92 +++ .../Window/PlayerExperiencePointsBar.cs.meta | 11 + 35 files changed, 1713 insertions(+), 2 deletions(-) create mode 100644 src/maple-fighters/Assets/Maple Fighters/Resources/UI/PlayerDataWindow.prefab create mode 100644 src/maple-fighters/Assets/Maple Fighters/Resources/UI/PlayerDataWindow.prefab.meta create mode 100644 src/maple-fighters/Assets/Maple Fighters/Resources/UI/PlayerExperiencePointsBar.prefab create mode 100644 src/maple-fighters/Assets/Maple Fighters/Resources/UI/PlayerExperiencePointsBar.prefab.meta create mode 100644 src/maple-fighters/Assets/Maple Fighters/Scripts/Gameplay/Player/Controller/States/PlayerDeadState.cs create mode 100644 src/maple-fighters/Assets/Maple Fighters/Scripts/Gameplay/Player/Controller/States/PlayerDeadState.cs.meta create mode 100644 src/maple-fighters/Assets/Maple Fighters/Scripts/Gameplay/Player/Data.meta create mode 100644 src/maple-fighters/Assets/Maple Fighters/Scripts/Gameplay/Player/Data/PlayerHealth.cs create mode 100644 src/maple-fighters/Assets/Maple Fighters/Scripts/Gameplay/Player/Data/PlayerHealth.cs.meta create mode 100644 src/maple-fighters/Assets/Maple Fighters/Scripts/UI/PlayerData.meta create mode 100644 src/maple-fighters/Assets/Maple Fighters/Scripts/UI/PlayerData/Controller.meta create mode 100644 src/maple-fighters/Assets/Maple Fighters/Scripts/UI/PlayerData/Controller/PlayerDataController.cs create mode 100644 src/maple-fighters/Assets/Maple Fighters/Scripts/UI/PlayerData/Controller/PlayerDataController.cs.meta create mode 100644 src/maple-fighters/Assets/Maple Fighters/Scripts/UI/PlayerData/Window.meta create mode 100644 src/maple-fighters/Assets/Maple Fighters/Scripts/UI/PlayerData/Window/IPlayerDataView.cs create mode 100644 src/maple-fighters/Assets/Maple Fighters/Scripts/UI/PlayerData/Window/IPlayerDataView.cs.meta create mode 100644 src/maple-fighters/Assets/Maple Fighters/Scripts/UI/PlayerData/Window/IPlayerExperiencePointsView.cs create mode 100644 src/maple-fighters/Assets/Maple Fighters/Scripts/UI/PlayerData/Window/IPlayerExperiencePointsView.cs.meta create mode 100644 src/maple-fighters/Assets/Maple Fighters/Scripts/UI/PlayerData/Window/PlayerDataWindow.cs create mode 100644 src/maple-fighters/Assets/Maple Fighters/Scripts/UI/PlayerData/Window/PlayerDataWindow.cs.meta create mode 100644 src/maple-fighters/Assets/Maple Fighters/Scripts/UI/PlayerData/Window/PlayerExperiencePointsBar.cs create mode 100644 src/maple-fighters/Assets/Maple Fighters/Scripts/UI/PlayerData/Window/PlayerExperiencePointsBar.cs.meta diff --git a/src/maple-fighters/Assets/Maple Fighters/Resources/Game/Characters/Archer.prefab b/src/maple-fighters/Assets/Maple Fighters/Resources/Game/Characters/Archer.prefab index e10675304..1f84c87f4 100644 --- a/src/maple-fighters/Assets/Maple Fighters/Resources/Game/Characters/Archer.prefab +++ b/src/maple-fighters/Assets/Maple Fighters/Resources/Game/Characters/Archer.prefab @@ -472,6 +472,7 @@ GameObject: - component: {fileID: 114791287851909474} - component: {fileID: 114474275508558034} - component: {fileID: 4397616534160401849} + - component: {fileID: 866096450993677657} m_Layer: 0 m_Name: Archer m_TagString: Untagged @@ -616,6 +617,19 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: characterSprite: {fileID: 1229620062354838} +--- !u!114 &866096450993677657 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1672393161269726} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 73cfe5cb0090d42fc94d3ab2256fabe8, type: 3} + m_Name: + m_EditorClassIdentifier: + healthAmount: 500 --- !u!1 &6763482453901833201 GameObject: m_ObjectHideFlags: 0 diff --git a/src/maple-fighters/Assets/Maple Fighters/Resources/Game/Characters/Knight.prefab b/src/maple-fighters/Assets/Maple Fighters/Resources/Game/Characters/Knight.prefab index 66f716dc3..af0b93f7b 100644 --- a/src/maple-fighters/Assets/Maple Fighters/Resources/Game/Characters/Knight.prefab +++ b/src/maple-fighters/Assets/Maple Fighters/Resources/Game/Characters/Knight.prefab @@ -472,6 +472,7 @@ GameObject: - component: {fileID: 114086648407061294} - component: {fileID: 114664649952649960} - component: {fileID: 5539059543134416113} + - component: {fileID: 1337271320379226147} m_Layer: 0 m_Name: Knight m_TagString: Untagged @@ -616,6 +617,19 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: characterSprite: {fileID: 1734782633609212} +--- !u!114 &1337271320379226147 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1795698667356696} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 73cfe5cb0090d42fc94d3ab2256fabe8, type: 3} + m_Name: + m_EditorClassIdentifier: + healthAmount: 1000 --- !u!1 &7627006276340788893 GameObject: m_ObjectHideFlags: 0 diff --git a/src/maple-fighters/Assets/Maple Fighters/Resources/Game/Characters/Wizard.prefab b/src/maple-fighters/Assets/Maple Fighters/Resources/Game/Characters/Wizard.prefab index da1d28b19..a392ec31e 100644 --- a/src/maple-fighters/Assets/Maple Fighters/Resources/Game/Characters/Wizard.prefab +++ b/src/maple-fighters/Assets/Maple Fighters/Resources/Game/Characters/Wizard.prefab @@ -132,6 +132,7 @@ GameObject: - component: {fileID: 114615997679115346} - component: {fileID: 114769968751128320} - component: {fileID: -9056175464833686089} + - component: {fileID: 5610465354671830875} m_Layer: 0 m_Name: Wizard m_TagString: Untagged @@ -276,6 +277,19 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: characterSprite: {fileID: 1733968886697200} +--- !u!114 &5610465354671830875 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1210278977448276} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 73cfe5cb0090d42fc94d3ab2256fabe8, type: 3} + m_Name: + m_EditorClassIdentifier: + healthAmount: 500 --- !u!1 &1276592372013812 GameObject: m_ObjectHideFlags: 0 diff --git a/src/maple-fighters/Assets/Maple Fighters/Resources/Game/Entities/BlueSnail.prefab b/src/maple-fighters/Assets/Maple Fighters/Resources/Game/Entities/BlueSnail.prefab index f05ad3782..46c48ccd5 100644 --- a/src/maple-fighters/Assets/Maple Fighters/Resources/Game/Entities/BlueSnail.prefab +++ b/src/maple-fighters/Assets/Maple Fighters/Resources/Game/Entities/BlueSnail.prefab @@ -533,6 +533,7 @@ MonoBehaviour: attackedAnimation: {fileID: 1226959955713265118} deadAnimation: {fileID: 996590074768006885} health: 100 + mobExperience: 5 mobDamageText: {fileID: 8469844777433203015, guid: 87e1f42ee42344620acfbd1da4926470, type: 3} mobDamagePosition: {fileID: 4756870909268700154} diff --git a/src/maple-fighters/Assets/Maple Fighters/Resources/Game/Entities/Mushroom.prefab b/src/maple-fighters/Assets/Maple Fighters/Resources/Game/Entities/Mushroom.prefab index 4d3f02367..6fc960c26 100644 --- a/src/maple-fighters/Assets/Maple Fighters/Resources/Game/Entities/Mushroom.prefab +++ b/src/maple-fighters/Assets/Maple Fighters/Resources/Game/Entities/Mushroom.prefab @@ -106,6 +106,7 @@ MonoBehaviour: attackedAnimation: {fileID: 2809993840063044388} deadAnimation: {fileID: 4445643555974304797} health: 100 + mobExperience: 10 mobDamageText: {fileID: 8469844777433203015, guid: 87e1f42ee42344620acfbd1da4926470, type: 3} mobDamagePosition: {fileID: 7720485623999414934} diff --git a/src/maple-fighters/Assets/Maple Fighters/Resources/UI/ChatWindow.prefab b/src/maple-fighters/Assets/Maple Fighters/Resources/UI/ChatWindow.prefab index 81f339f56..c464e1569 100644 --- a/src/maple-fighters/Assets/Maple Fighters/Resources/UI/ChatWindow.prefab +++ b/src/maple-fighters/Assets/Maple Fighters/Resources/UI/ChatWindow.prefab @@ -230,7 +230,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} - m_AnchoredPosition: {x: 120, y: 80} + m_AnchoredPosition: {x: 115, y: 90} m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &114161394725660716 diff --git a/src/maple-fighters/Assets/Maple Fighters/Resources/UI/PlayerDataWindow.prefab b/src/maple-fighters/Assets/Maple Fighters/Resources/UI/PlayerDataWindow.prefab new file mode 100644 index 000000000..0156a4cb6 --- /dev/null +++ b/src/maple-fighters/Assets/Maple Fighters/Resources/UI/PlayerDataWindow.prefab @@ -0,0 +1,672 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &2851153018519513710 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 6887179694455624769} + - component: {fileID: 1573851994878708418} + - component: {fileID: 416670304788626955} + m_Layer: 5 + m_Name: Name + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &6887179694455624769 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2851153018519513710} + 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_Children: [] + m_Father: {fileID: 2933742795936047319} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0.5} + m_AnchorMax: {x: 1, y: 0.5} + m_AnchoredPosition: {x: 20.895, y: 20.5} + m_SizeDelta: {x: -51.7891, y: 25} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &1573851994878708418 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2851153018519513710} + m_CullTransparentMesh: 1 +--- !u!114 &416670304788626955 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2851153018519513710} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 15 + m_FontStyle: 1 + m_BestFit: 1 + m_MinSize: 10 + m_MaxSize: 15 + m_Alignment: 4 + m_AlignByGeometry: 1 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: iamshadowman38 +--- !u!1 &2933742793837800566 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2933742793837800567} + - component: {fileID: 2933742793837800565} + - component: {fileID: 2933742793837800564} + m_Layer: 5 + m_Name: Amount Text + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2933742793837800567 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2933742793837800566} + 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_Children: [] + m_Father: {fileID: 2933742795185477676} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0.5} + m_AnchorMax: {x: 1, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0.5} + m_SizeDelta: {x: 0, y: 20} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &2933742793837800565 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2933742793837800566} + m_CullTransparentMesh: 1 +--- !u!114 &2933742793837800564 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2933742793837800566} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 13 + m_FontStyle: 1 + m_BestFit: 0 + m_MinSize: 0 + m_MaxSize: 125 + m_Alignment: 4 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: 1000 HP +--- !u!1 &2933742793947092886 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2933742793947092887} + - component: {fileID: 2933742793947092884} + m_Layer: 5 + m_Name: PlayerHealth + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2933742793947092887 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2933742793947092886} + 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_Children: + - {fileID: 2933742795676954111} + - {fileID: 2933742795185477676} + m_Father: {fileID: 2933742795936047319} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0.5} + m_AnchorMax: {x: 1, y: 0.5} + m_AnchoredPosition: {x: 0, y: -15.5} + m_SizeDelta: {x: -10, y: 33.99} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &2933742793947092884 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2933742793947092886} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 67db9e8f0e2ae9c40bc1e2b64352a6b4, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_WrapAround: 0 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 0 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_SelectedTrigger: Selected + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 0} + m_FillRect: {fileID: 2933742794405644578} + m_HandleRect: {fileID: 0} + m_Direction: 0 + m_MinValue: 0 + m_MaxValue: 250 + m_WholeNumbers: 0 + m_Value: 250 + m_OnValueChanged: + m_PersistentCalls: + m_Calls: [] +--- !u!1 &2933742794209430767 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2933742794209430764} + - component: {fileID: 2933742794209430762} + - component: {fileID: 2933742794209430765} + m_Layer: 5 + m_Name: Background + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2933742794209430764 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2933742794209430767} + 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_Children: [] + m_Father: {fileID: 2933742795936047319} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &2933742794209430762 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2933742794209430767} + m_CullTransparentMesh: 1 +--- !u!114 &2933742794209430765 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2933742794209430767} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0, g: 0, b: 0, a: 0.5882353} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!1 &2933742794405644581 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2933742794405644578} + - component: {fileID: 2933742794405644576} + - component: {fileID: 2933742794405644579} + m_Layer: 5 + m_Name: Fill + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2933742794405644578 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2933742794405644581} + 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_Children: [] + m_Father: {fileID: 2933742795185477676} + m_RootOrder: 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.5, y: 0.5} +--- !u!222 &2933742794405644576 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2933742794405644581} + m_CullTransparentMesh: 1 +--- !u!114 &2933742794405644579 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2933742794405644581} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 0, b: 0, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!1 &2933742795185477679 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2933742795185477676} + m_Layer: 5 + m_Name: Fill Area + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2933742795185477676 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2933742795185477679} + 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_Children: + - {fileID: 2933742794405644578} + - {fileID: 2933742793837800567} + m_Father: {fileID: 2933742793947092887} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0.25} + m_AnchorMax: {x: 1, y: 0.75} + m_AnchoredPosition: {x: 0, y: 0.0000009536743} + m_SizeDelta: {x: 0, y: 16.9945} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!1 &2933742795414276655 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2933742795414276652} + - component: {fileID: 2933742795414276650} + - component: {fileID: 2933742795414276653} + m_Layer: 5 + m_Name: Level + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2933742795414276652 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2933742795414276655} + 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_Children: [] + m_Father: {fileID: 2933742795936047319} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0.5} + m_AnchorMax: {x: 0, y: 0.5} + m_AnchoredPosition: {x: 26.091, y: 20.5} + m_SizeDelta: {x: 42.179, y: 25} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &2933742795414276650 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2933742795414276655} + m_CullTransparentMesh: 1 +--- !u!114 &2933742795414276653 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2933742795414276655} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 0.5882353, b: 0, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 15 + m_FontStyle: 1 + m_BestFit: 1 + m_MinSize: 10 + m_MaxSize: 15 + m_Alignment: 3 + m_AlignByGeometry: 1 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: Lv. 1 +--- !u!1 &2933742795676954110 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2933742795676954111} + - component: {fileID: 2933742795676954109} + - component: {fileID: 2933742795676954108} + m_Layer: 5 + m_Name: Background + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2933742795676954111 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2933742795676954110} + 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_Children: [] + m_Father: {fileID: 2933742793947092887} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0.25} + m_AnchorMax: {x: 1, y: 0.75} + m_AnchoredPosition: {x: 0, y: 0.0000009536743} + m_SizeDelta: {x: 0, y: 16.9945} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &2933742795676954109 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2933742795676954110} + m_CullTransparentMesh: 1 +--- !u!114 &2933742795676954108 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2933742795676954110} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0, g: 0, b: 0, a: 0.5882353} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!1 &2933742795936047318 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2933742795936047319} + - component: {fileID: -8587933455296026127} + - component: {fileID: -9120775291138659228} + - component: {fileID: -4455139516842661247} + m_Layer: 5 + m_Name: PlayerDataWindow + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2933742795936047319 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2933742795936047318} + 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_Children: + - {fileID: 2933742794209430764} + - {fileID: 2933742795414276652} + - {fileID: 6887179694455624769} + - {fileID: 2933742793947092887} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 95, y: -51.229} + m_SizeDelta: {x: 170.39, y: 77.959} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &-8587933455296026127 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2933742795936047318} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 93c85351a19d341b7a1e04369bc62784, type: 3} + m_Name: + m_EditorClassIdentifier: + playerLevelText: {fileID: 2933742795414276653} + playerNameText: {fileID: 416670304788626955} + healthPointsBar: {fileID: 2933742793947092884} + healthPointsText: {fileID: 2933742793837800564} +--- !u!225 &-9120775291138659228 +CanvasGroup: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2933742795936047318} + m_Enabled: 1 + m_Alpha: 1 + m_Interactable: 1 + m_BlocksRaycasts: 1 + m_IgnoreParentGroups: 0 +--- !u!114 &-4455139516842661247 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2933742795936047318} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 89120f4eafbec465e86e5fe9535048a1, type: 3} + m_Name: + m_EditorClassIdentifier: diff --git a/src/maple-fighters/Assets/Maple Fighters/Resources/UI/PlayerDataWindow.prefab.meta b/src/maple-fighters/Assets/Maple Fighters/Resources/UI/PlayerDataWindow.prefab.meta new file mode 100644 index 000000000..ffb646c2a --- /dev/null +++ b/src/maple-fighters/Assets/Maple Fighters/Resources/UI/PlayerDataWindow.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 72534a1eadd414117a2a905b405f35ec +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/src/maple-fighters/Assets/Maple Fighters/Resources/UI/PlayerExperiencePointsBar.prefab b/src/maple-fighters/Assets/Maple Fighters/Resources/UI/PlayerExperiencePointsBar.prefab new file mode 100644 index 000000000..3028bbc59 --- /dev/null +++ b/src/maple-fighters/Assets/Maple Fighters/Resources/UI/PlayerExperiencePointsBar.prefab @@ -0,0 +1,411 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &1725493373495838818 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4428605650513148306} + - component: {fileID: 2275372427326514466} + - component: {fileID: 7803939155885906849} + - component: {fileID: 8755540534385583886} + - component: {fileID: 1200528106134366981} + - component: {fileID: 1902143937285164450} + m_Layer: 5 + m_Name: PlayerExperiencePointsBar + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &4428605650513148306 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1725493373495838818} + 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_Children: + - {fileID: 4157931843578542106} + - {fileID: 7193964047436502593} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 0} + m_AnchoredPosition: {x: 0, y: 7.75} + m_SizeDelta: {x: 0, y: 17.75} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &2275372427326514466 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1725493373495838818} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 67db9e8f0e2ae9c40bc1e2b64352a6b4, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_WrapAround: 0 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 0 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_SelectedTrigger: Selected + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 0} + m_FillRect: {fileID: 500030997566646602} + m_HandleRect: {fileID: 0} + m_Direction: 0 + m_MinValue: 0 + m_MaxValue: 0 + m_WholeNumbers: 0 + m_Value: 0 + m_OnValueChanged: + m_PersistentCalls: + m_Calls: [] +--- !u!114 &7803939155885906849 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1725493373495838818} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 04329f8d920f2428da0cbc80d5b5ef7c, type: 3} + m_Name: + m_EditorClassIdentifier: + experiencePointsBar: {fileID: 2275372427326514466} + experiencePointsText: {fileID: 2990011753554911876} +--- !u!225 &8755540534385583886 +CanvasGroup: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1725493373495838818} + m_Enabled: 1 + m_Alpha: 1 + m_Interactable: 1 + m_BlocksRaycasts: 1 + m_IgnoreParentGroups: 0 +--- !u!114 &1200528106134366981 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1725493373495838818} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 89120f4eafbec465e86e5fe9535048a1, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!114 &1902143937285164450 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1725493373495838818} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: b1b155907f04e4ed5b646a9ebf45531a, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1 &5380831377255754779 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 289752785462223307} + - component: {fileID: 2650575786927482388} + - component: {fileID: 2990011753554911876} + m_Layer: 5 + m_Name: Amount Text + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &289752785462223307 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5380831377255754779} + 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_Children: [] + m_Father: {fileID: 7193964047436502593} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0.5} + m_AnchorMax: {x: 1, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 20} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &2650575786927482388 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5380831377255754779} + m_CullTransparentMesh: 1 +--- !u!114 &2990011753554911876 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5380831377255754779} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 13 + m_FontStyle: 1 + m_BestFit: 0 + m_MinSize: 0 + m_MaxSize: 125 + m_Alignment: 4 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: 0% EXP +--- !u!1 &6172180117752066494 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 7193964047436502593} + m_Layer: 5 + m_Name: Fill Area + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &7193964047436502593 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6172180117752066494} + 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_Children: + - {fileID: 500030997566646602} + - {fileID: 289752785462223307} + m_Father: {fileID: 4428605650513148306} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0.25} + m_AnchorMax: {x: 1, y: 0.75} + m_AnchoredPosition: {x: 0, y: 0.125} + m_SizeDelta: {x: 0, y: 8.625} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!1 &6876032373177938517 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4157931843578542106} + - component: {fileID: 6019002126220313460} + - component: {fileID: 1566366267334048535} + m_Layer: 5 + m_Name: Background + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &4157931843578542106 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6876032373177938517} + 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_Children: [] + m_Father: {fileID: 4428605650513148306} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0.25} + m_AnchorMax: {x: 1, y: 0.75} + m_AnchoredPosition: {x: 0, y: 0.125} + m_SizeDelta: {x: 0, y: 8.625} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &6019002126220313460 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6876032373177938517} + m_CullTransparentMesh: 1 +--- !u!114 &1566366267334048535 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6876032373177938517} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0, g: 0, b: 0, a: 0.5882353} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!1 &8991188739077442146 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 500030997566646602} + - component: {fileID: 5103683033521821967} + - component: {fileID: 3893622202603646449} + m_Layer: 5 + m_Name: Fill + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &500030997566646602 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8991188739077442146} + 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_Children: [] + m_Father: {fileID: 7193964047436502593} + m_RootOrder: 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.5, y: 0.5} +--- !u!222 &5103683033521821967 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8991188739077442146} + m_CullTransparentMesh: 1 +--- !u!114 &3893622202603646449 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8991188739077442146} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0, g: 0.7058824, b: 0.39215687, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 diff --git a/src/maple-fighters/Assets/Maple Fighters/Resources/UI/PlayerExperiencePointsBar.prefab.meta b/src/maple-fighters/Assets/Maple Fighters/Resources/UI/PlayerExperiencePointsBar.prefab.meta new file mode 100644 index 000000000..f42c47ab0 --- /dev/null +++ b/src/maple-fighters/Assets/Maple Fighters/Resources/UI/PlayerExperiencePointsBar.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: bdef210b9812843f395e313df174038f +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/src/maple-fighters/Assets/Maple Fighters/Scripts/Gameplay/Creator/GameSystemsCreator.cs b/src/maple-fighters/Assets/Maple Fighters/Scripts/Gameplay/Creator/GameSystemsCreator.cs index 929b7576a..a95848826 100644 --- a/src/maple-fighters/Assets/Maple Fighters/Scripts/Gameplay/Creator/GameSystemsCreator.cs +++ b/src/maple-fighters/Assets/Maple Fighters/Scripts/Gameplay/Creator/GameSystemsCreator.cs @@ -7,6 +7,7 @@ using Scripts.UI.Focus; using Scripts.UI.GameServer; using Scripts.UI.Notice; +using Scripts.UI.PlayerData; using UI; using UnityEngine; @@ -39,6 +40,7 @@ private IEnumerable GetGUIControllersComponents() yield return typeof(FocusStateController); yield return typeof(NoticeController); yield return typeof(ChatController); + yield return typeof(PlayerDataController); yield return typeof(GameServerDisconnectionHandler); } diff --git a/src/maple-fighters/Assets/Maple Fighters/Scripts/Gameplay/Map/Objects/Mob/MobBehaviour.cs b/src/maple-fighters/Assets/Maple Fighters/Scripts/Gameplay/Map/Objects/Mob/MobBehaviour.cs index 3ea62d28e..5c87f1087 100644 --- a/src/maple-fighters/Assets/Maple Fighters/Scripts/Gameplay/Map/Objects/Mob/MobBehaviour.cs +++ b/src/maple-fighters/Assets/Maple Fighters/Scripts/Gameplay/Map/Objects/Mob/MobBehaviour.cs @@ -1,4 +1,5 @@ using Scripts.Gameplay.Graphics; +using Scripts.Services; using UnityEngine; namespace Scripts.Gameplay.Map.Objects @@ -17,6 +18,9 @@ public class MobBehaviour : MonoBehaviour [SerializeField] private int health = 100; + [SerializeField] + private float mobExperience = 10; + [Header("Mob Damage Effect")] [SerializeField] private GameObject mobDamageText; @@ -58,6 +62,12 @@ private void OnUnFadeEffectStarted() { deadAnimation?.Play(); attackedAnimation?.Stop(); + + var userMetadata = FindObjectOfType(); + if (userMetadata != null) + { + userMetadata.AddExperiencePoints(mobExperience); + } } } diff --git a/src/maple-fighters/Assets/Maple Fighters/Scripts/Gameplay/Player/Controller/Behaviours/PlayerAttackedBehaviour.cs b/src/maple-fighters/Assets/Maple Fighters/Scripts/Gameplay/Player/Controller/Behaviours/PlayerAttackedBehaviour.cs index a49879e47..cae0937fa 100644 --- a/src/maple-fighters/Assets/Maple Fighters/Scripts/Gameplay/Player/Controller/Behaviours/PlayerAttackedBehaviour.cs +++ b/src/maple-fighters/Assets/Maple Fighters/Scripts/Gameplay/Player/Controller/Behaviours/PlayerAttackedBehaviour.cs @@ -7,7 +7,7 @@ namespace Scripts.Gameplay.Player.Behaviours { - [RequireComponent(typeof(PlayerController))] + [RequireComponent(typeof(PlayerController), typeof(PlayerHealth))] public class PlayerAttackedBehaviour : MonoBehaviour { [SerializeField] @@ -21,11 +21,14 @@ public class PlayerAttackedBehaviour : MonoBehaviour private IGameApi gameApi; private PlayerController playerController; + private PlayerHealth playerHealth; + private bool isAttacked; private void Awake() { playerController = GetComponent(); + playerHealth = GetComponent(); } private void Start() @@ -55,6 +58,9 @@ private void OnAttacked(AttackedMessage message) x: (normalized.x > 0 ? 1 : -1) * hitAmount.x, y: hitAmount.y); + // TODO: Use message.DamageAmount (unique per enemy) + playerHealth.Damage(); + StartAttackedEffect(direction); } } diff --git a/src/maple-fighters/Assets/Maple Fighters/Scripts/Gameplay/Player/Controller/PlayerController.cs b/src/maple-fighters/Assets/Maple Fighters/Scripts/Gameplay/Player/Controller/PlayerController.cs index de1f8ca46..be1c8efa2 100644 --- a/src/maple-fighters/Assets/Maple Fighters/Scripts/Gameplay/Player/Controller/PlayerController.cs +++ b/src/maple-fighters/Assets/Maple Fighters/Scripts/Gameplay/Player/Controller/PlayerController.cs @@ -65,6 +65,7 @@ private void Awake() { PlayerStates.Moving, new PlayerMovingState(this) }, { PlayerStates.Jumping, new PlayerJumpingState(this) }, { PlayerStates.Falling, new PlayerFallingState(this) }, + { PlayerStates.Dead, new PlayerDeadState() }, { PlayerStates.Rope, new PlayerClimbState(this) }, { PlayerStates.Ladder, new PlayerClimbState(this) }, { PlayerStates.PrimaryAttack, new PlayerPrimaryAttackState(this) }, diff --git a/src/maple-fighters/Assets/Maple Fighters/Scripts/Gameplay/Player/Controller/PlayerStateAnimator.cs b/src/maple-fighters/Assets/Maple Fighters/Scripts/Gameplay/Player/Controller/PlayerStateAnimator.cs index b026c1cbb..1a74330bf 100644 --- a/src/maple-fighters/Assets/Maple Fighters/Scripts/Gameplay/Player/Controller/PlayerStateAnimator.cs +++ b/src/maple-fighters/Assets/Maple Fighters/Scripts/Gameplay/Player/Controller/PlayerStateAnimator.cs @@ -85,6 +85,7 @@ private void SetPlayerAnimationState(Animator animator, PlayerStates playerState var isMoving = playerState == PlayerStates.Moving; var isJumping = playerState == PlayerStates.Jumping; var isFalling = playerState == PlayerStates.Falling; + var isDead = playerState == PlayerStates.Dead; var isRope = playerState == PlayerStates.Rope; var isLadder = playerState == PlayerStates.Ladder; var isPrimaryAttack = playerState == PlayerStates.PrimaryAttack; @@ -92,6 +93,7 @@ private void SetPlayerAnimationState(Animator animator, PlayerStates playerState animator.SetBool(PlayerStates.Moving.ToString(), isMoving); animator.SetBool(PlayerStates.Jumping.ToString(), isJumping || isFalling); + animator.SetBool(PlayerStates.Dead.ToString(), isDead); animator.SetBool(PlayerStates.Rope.ToString(), isRope); animator.SetBool(PlayerStates.Ladder.ToString(), isLadder); animator.SetBool(PlayerStates.PrimaryAttack.ToString(), isPrimaryAttack); diff --git a/src/maple-fighters/Assets/Maple Fighters/Scripts/Gameplay/Player/Controller/PlayerStates.cs b/src/maple-fighters/Assets/Maple Fighters/Scripts/Gameplay/Player/Controller/PlayerStates.cs index bcd4f782d..9198558eb 100644 --- a/src/maple-fighters/Assets/Maple Fighters/Scripts/Gameplay/Player/Controller/PlayerStates.cs +++ b/src/maple-fighters/Assets/Maple Fighters/Scripts/Gameplay/Player/Controller/PlayerStates.cs @@ -22,6 +22,11 @@ public enum PlayerStates /// Falling, + /// + /// The dead state. + /// + Dead, + /// /// The rope climb state. /// diff --git a/src/maple-fighters/Assets/Maple Fighters/Scripts/Gameplay/Player/Controller/States/PlayerDeadState.cs b/src/maple-fighters/Assets/Maple Fighters/Scripts/Gameplay/Player/Controller/States/PlayerDeadState.cs new file mode 100644 index 000000000..c1a9db0eb --- /dev/null +++ b/src/maple-fighters/Assets/Maple Fighters/Scripts/Gameplay/Player/Controller/States/PlayerDeadState.cs @@ -0,0 +1,28 @@ +namespace Scripts.Gameplay.Player.States +{ + public class PlayerDeadState : IPlayerStateBehaviour + { + public void OnStateEnter() + { + // Left blank intentionally + + } + + public void OnStateUpdate() + { + // Left blank intentionally + + } + + public void OnStateFixedUpdate() + { + // Left blank intentionally + + } + + public void OnStateExit() + { + // Left blank intentionally + } + } +} \ No newline at end of file diff --git a/src/maple-fighters/Assets/Maple Fighters/Scripts/Gameplay/Player/Controller/States/PlayerDeadState.cs.meta b/src/maple-fighters/Assets/Maple Fighters/Scripts/Gameplay/Player/Controller/States/PlayerDeadState.cs.meta new file mode 100644 index 000000000..51c8b3967 --- /dev/null +++ b/src/maple-fighters/Assets/Maple Fighters/Scripts/Gameplay/Player/Controller/States/PlayerDeadState.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3a105799365a1453486ff6d8d9490b13 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/src/maple-fighters/Assets/Maple Fighters/Scripts/Gameplay/Player/Data.meta b/src/maple-fighters/Assets/Maple Fighters/Scripts/Gameplay/Player/Data.meta new file mode 100644 index 000000000..90970827d --- /dev/null +++ b/src/maple-fighters/Assets/Maple Fighters/Scripts/Gameplay/Player/Data.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 510e1e9eb9d46407e8c858522d7038a8 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/src/maple-fighters/Assets/Maple Fighters/Scripts/Gameplay/Player/Data/PlayerHealth.cs b/src/maple-fighters/Assets/Maple Fighters/Scripts/Gameplay/Player/Data/PlayerHealth.cs new file mode 100644 index 000000000..6defd6a61 --- /dev/null +++ b/src/maple-fighters/Assets/Maple Fighters/Scripts/Gameplay/Player/Data/PlayerHealth.cs @@ -0,0 +1,81 @@ +using System.Collections; +using UnityEngine; +using UnityEngine.SceneManagement; +using Scripts.UI.ScreenFade; +using Scripts.UI.PlayerData; + +namespace Scripts.Gameplay.Player +{ + [RequireComponent(typeof(PlayerController))] + public class PlayerHealth : MonoBehaviour + { + [SerializeField] + private int healthAmount; + + private bool isDead; + + private PlayerController playerController; + private ScreenFadeController screenFadeController; + private PlayerDataController playerDataController; + + private void Awake() + { + playerController = GetComponent(); + screenFadeController = FindObjectOfType(); + playerDataController = FindObjectOfType(); + } + + private void Start() + { + playerDataController.SetMaxPlayerHealth(healthAmount); + playerDataController.SetPlayerHealth(healthAmount); + } + + public void Damage() + { + if (isDead) + { + return; + } + + healthAmount -= Random.Range(50, 150); + + if (healthAmount <= 0) + { + isDead = true; + + StartCoroutine(Dead()); + } + + playerDataController.SetPlayerHealth(healthAmount <= 0 ? 0 : healthAmount); + } + + private IEnumerator Dead() + { + playerController.SetPlayerState(PlayerStates.Dead); + + yield return new WaitForSeconds(5f); + + LoadLobby(); + } + + private void LoadLobby() + { + if (screenFadeController != null) + { + screenFadeController.Show(); + screenFadeController.FadeInCompleted += OnFadeInCompleted; + } + } + + private void OnFadeInCompleted() + { + if (screenFadeController != null) + { + screenFadeController.FadeInCompleted -= OnFadeInCompleted; + } + + SceneManager.LoadScene(sceneName: Constants.SceneNames.Maps.Lobby); + } + } +} \ No newline at end of file diff --git a/src/maple-fighters/Assets/Maple Fighters/Scripts/Gameplay/Player/Data/PlayerHealth.cs.meta b/src/maple-fighters/Assets/Maple Fighters/Scripts/Gameplay/Player/Data/PlayerHealth.cs.meta new file mode 100644 index 000000000..73dbb72d8 --- /dev/null +++ b/src/maple-fighters/Assets/Maple Fighters/Scripts/Gameplay/Player/Data/PlayerHealth.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 73cfe5cb0090d42fc94d3ab2256fabe8 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/src/maple-fighters/Assets/Maple Fighters/Scripts/Services/UserMetadata.cs b/src/maple-fighters/Assets/Maple Fighters/Scripts/Services/UserMetadata.cs index 3b503c869..017f2c44d 100644 --- a/src/maple-fighters/Assets/Maple Fighters/Scripts/Services/UserMetadata.cs +++ b/src/maple-fighters/Assets/Maple Fighters/Scripts/Services/UserMetadata.cs @@ -7,12 +7,20 @@ namespace Scripts.Services { public class UserMetadata : MonoBehaviour { + public event Action CharacterExperiencePointsAdded; + + public event Action CharacterLevelUp; + public UserData UserData { get; set; } public int CharacterType { get; set; } + public int CharacterLevel { get; set; } + public string CharacterName { get; set; } + public float CharacterExperiencePoints { get; set; } + public bool IsLoggedIn { get; set; } private void Awake() @@ -26,6 +34,39 @@ private void Start() { id = GetUserId() }; + + CharacterLevel = 1; + CharacterExperiencePoints = 0; + } + + public void AddExperiencePoints(float value) + { + CharacterExperiencePoints += value; + CharacterExperiencePointsAdded.Invoke(value); + + if (CharacterExperiencePoints >= GetMaxExperiencePoints()) + { + CharacterExperiencePoints = 0; + + AddLevel(); + } + } + + public void AddLevel() + { + CharacterLevel++; + + CharacterLevelUp.Invoke(CharacterLevel); + } + + public float GetExperiencePoints() + { + return CharacterExperiencePoints; + } + + public float GetMaxExperiencePoints() + { + return CharacterLevel * 100; } private string GetUserId() diff --git a/src/maple-fighters/Assets/Maple Fighters/Scripts/UI/PlayerData.meta b/src/maple-fighters/Assets/Maple Fighters/Scripts/UI/PlayerData.meta new file mode 100644 index 000000000..b272033e3 --- /dev/null +++ b/src/maple-fighters/Assets/Maple Fighters/Scripts/UI/PlayerData.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 57bf057a8e2ec4774a9373b5b1d2589d +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/src/maple-fighters/Assets/Maple Fighters/Scripts/UI/PlayerData/Controller.meta b/src/maple-fighters/Assets/Maple Fighters/Scripts/UI/PlayerData/Controller.meta new file mode 100644 index 000000000..b0dc77bf5 --- /dev/null +++ b/src/maple-fighters/Assets/Maple Fighters/Scripts/UI/PlayerData/Controller.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f75a5687f95444f2b90c7aaf69d3ba9b +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/src/maple-fighters/Assets/Maple Fighters/Scripts/UI/PlayerData/Controller/PlayerDataController.cs b/src/maple-fighters/Assets/Maple Fighters/Scripts/UI/PlayerData/Controller/PlayerDataController.cs new file mode 100644 index 000000000..a2c8274bc --- /dev/null +++ b/src/maple-fighters/Assets/Maple Fighters/Scripts/UI/PlayerData/Controller/PlayerDataController.cs @@ -0,0 +1,105 @@ +using UI; +using UnityEngine; +using Scripts.Services; + +namespace Scripts.UI.PlayerData +{ + public class PlayerDataController : MonoBehaviour + { + private IPlayerDataView playerDataView; + private IPlayerExperiencePointsView playerExperiencePointsView; + + private void Awake() + { + CreatePlayerDataWindow(); + CreatePlayerExperiencePointsBar(); + } + + private void Start() + { + var userMetadata = FindObjectOfType(); + if (userMetadata != null) + { + SetPlayerLevel(userMetadata.CharacterLevel); + SetPlayerName(userMetadata.CharacterName); + + SetMaxPlayerExperiencePoints(userMetadata.GetMaxExperiencePoints()); + SetPlayerExperiencePoints(userMetadata.GetExperiencePoints()); + + userMetadata.CharacterExperiencePointsAdded += OnCharacterExperiencePointsAdded; + userMetadata.CharacterLevelUp += OnCharacterLevelUp; + } + } + + private void OnDestroy() + { + var userMetadata = FindObjectOfType(); + if (userMetadata != null) + { + userMetadata.CharacterExperiencePointsAdded -= OnCharacterExperiencePointsAdded; + userMetadata.CharacterLevelUp -= OnCharacterLevelUp; + } + } + + public void SetPlayerLevel(int value) + { + playerDataView?.SetLevel(value); + } + + public void SetPlayerName(string value) + { + playerDataView?.SetName(value); + } + + public void SetPlayerHealth(int value) + { + playerDataView?.SetHealthPoints(value); + } + + public void SetMaxPlayerHealth(int value) + { + playerDataView?.SetMaxHealthPoints(value); + } + + public void SetPlayerExperiencePoints(float value) + { + playerExperiencePointsView?.SetExperiencePoints(value); + } + + public void SetMaxPlayerExperiencePoints(float value) + { + playerExperiencePointsView?.SetMaxExperiencePoints(value); + } + + private void CreatePlayerDataWindow() + { + playerDataView = UICreator + .GetInstance() + .Create(); + } + + private void CreatePlayerExperiencePointsBar() + { + playerExperiencePointsView = UICreator + .GetInstance() + .Create(); + } + + private void OnCharacterExperiencePointsAdded(float value) + { + playerExperiencePointsView?.AddExperiencePoints(value); + } + + private void OnCharacterLevelUp(int value) + { + playerDataView?.SetLevel(value); + + var userMetadata = FindObjectOfType(); + if (userMetadata != null) + { + SetMaxPlayerExperiencePoints(userMetadata.GetMaxExperiencePoints()); + SetPlayerExperiencePoints(userMetadata.GetExperiencePoints()); + } + } + } +} \ No newline at end of file diff --git a/src/maple-fighters/Assets/Maple Fighters/Scripts/UI/PlayerData/Controller/PlayerDataController.cs.meta b/src/maple-fighters/Assets/Maple Fighters/Scripts/UI/PlayerData/Controller/PlayerDataController.cs.meta new file mode 100644 index 000000000..ca8dc8099 --- /dev/null +++ b/src/maple-fighters/Assets/Maple Fighters/Scripts/UI/PlayerData/Controller/PlayerDataController.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 9f821c510c67e43c38e4224bcb415d88 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/src/maple-fighters/Assets/Maple Fighters/Scripts/UI/PlayerData/Window.meta b/src/maple-fighters/Assets/Maple Fighters/Scripts/UI/PlayerData/Window.meta new file mode 100644 index 000000000..e03ca756a --- /dev/null +++ b/src/maple-fighters/Assets/Maple Fighters/Scripts/UI/PlayerData/Window.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 2b1184e5d544c4256a4086283df548ec +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/src/maple-fighters/Assets/Maple Fighters/Scripts/UI/PlayerData/Window/IPlayerDataView.cs b/src/maple-fighters/Assets/Maple Fighters/Scripts/UI/PlayerData/Window/IPlayerDataView.cs new file mode 100644 index 000000000..073e36b9d --- /dev/null +++ b/src/maple-fighters/Assets/Maple Fighters/Scripts/UI/PlayerData/Window/IPlayerDataView.cs @@ -0,0 +1,13 @@ +namespace Scripts.UI.PlayerData +{ + public interface IPlayerDataView + { + void SetLevel(int level); + + void SetName(string name); + + void SetHealthPoints(int value); + + void SetMaxHealthPoints(int value); + } +} \ No newline at end of file diff --git a/src/maple-fighters/Assets/Maple Fighters/Scripts/UI/PlayerData/Window/IPlayerDataView.cs.meta b/src/maple-fighters/Assets/Maple Fighters/Scripts/UI/PlayerData/Window/IPlayerDataView.cs.meta new file mode 100644 index 000000000..1a565bc75 --- /dev/null +++ b/src/maple-fighters/Assets/Maple Fighters/Scripts/UI/PlayerData/Window/IPlayerDataView.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e2b51a65b5aa842f797fb486a1dbe091 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/src/maple-fighters/Assets/Maple Fighters/Scripts/UI/PlayerData/Window/IPlayerExperiencePointsView.cs b/src/maple-fighters/Assets/Maple Fighters/Scripts/UI/PlayerData/Window/IPlayerExperiencePointsView.cs new file mode 100644 index 000000000..37ca10c17 --- /dev/null +++ b/src/maple-fighters/Assets/Maple Fighters/Scripts/UI/PlayerData/Window/IPlayerExperiencePointsView.cs @@ -0,0 +1,11 @@ +namespace Scripts.UI.PlayerData +{ + public interface IPlayerExperiencePointsView + { + void AddExperiencePoints(float value); + + void SetExperiencePoints(float value); + + void SetMaxExperiencePoints(float value); + } +} \ No newline at end of file diff --git a/src/maple-fighters/Assets/Maple Fighters/Scripts/UI/PlayerData/Window/IPlayerExperiencePointsView.cs.meta b/src/maple-fighters/Assets/Maple Fighters/Scripts/UI/PlayerData/Window/IPlayerExperiencePointsView.cs.meta new file mode 100644 index 000000000..fd440635f --- /dev/null +++ b/src/maple-fighters/Assets/Maple Fighters/Scripts/UI/PlayerData/Window/IPlayerExperiencePointsView.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a2e37dfaa99b24a17be8f4998bd59eaf +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/src/maple-fighters/Assets/Maple Fighters/Scripts/UI/PlayerData/Window/PlayerDataWindow.cs b/src/maple-fighters/Assets/Maple Fighters/Scripts/UI/PlayerData/Window/PlayerDataWindow.cs new file mode 100644 index 000000000..96fbf3467 --- /dev/null +++ b/src/maple-fighters/Assets/Maple Fighters/Scripts/UI/PlayerData/Window/PlayerDataWindow.cs @@ -0,0 +1,64 @@ +using UI; +using UnityEngine; +using UnityEngine.UI; + +namespace Scripts.UI.PlayerData +{ + [RequireComponent(typeof(UICanvasGroup))] + public class PlayerDataWindow : UIElement, IPlayerDataView + { + [SerializeField] + private Text playerLevelText; + + [SerializeField] + private Text playerNameText; + + [SerializeField] + private Slider healthPointsBar; + + [SerializeField] + private Text healthPointsText; + + public void SetLevel(int level) + { + if (playerLevelText != null) + { + playerLevelText.text = "Lv." + " " + level; + } + } + + public void SetName(string name) + { + if (playerNameText != null) + { + playerNameText.text = name; + } + } + + public void SetHealthPoints(int value) + { + if (healthPointsBar != null) + { + healthPointsBar.value = value; + } + + if (healthPointsText != null) + { + healthPointsText.text = value + " " + "HP"; + } + } + + public void SetMaxHealthPoints(int value) + { + if (healthPointsBar != null) + { + healthPointsBar.maxValue = value; + } + + if (healthPointsText != null) + { + healthPointsText.text = value + " " + "HP"; + } + } + } +} \ No newline at end of file diff --git a/src/maple-fighters/Assets/Maple Fighters/Scripts/UI/PlayerData/Window/PlayerDataWindow.cs.meta b/src/maple-fighters/Assets/Maple Fighters/Scripts/UI/PlayerData/Window/PlayerDataWindow.cs.meta new file mode 100644 index 000000000..a1e739252 --- /dev/null +++ b/src/maple-fighters/Assets/Maple Fighters/Scripts/UI/PlayerData/Window/PlayerDataWindow.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 93c85351a19d341b7a1e04369bc62784 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/src/maple-fighters/Assets/Maple Fighters/Scripts/UI/PlayerData/Window/PlayerExperiencePointsBar.cs b/src/maple-fighters/Assets/Maple Fighters/Scripts/UI/PlayerData/Window/PlayerExperiencePointsBar.cs new file mode 100644 index 000000000..2269c10db --- /dev/null +++ b/src/maple-fighters/Assets/Maple Fighters/Scripts/UI/PlayerData/Window/PlayerExperiencePointsBar.cs @@ -0,0 +1,92 @@ +using System; +using UI; +using UnityEngine; +using UnityEngine.UI; + +namespace Scripts.UI.PlayerData +{ + [RequireComponent(typeof(UICanvasGroup), typeof(Slider))] + public class PlayerExperiencePointsBar : UIElement, IPlayerExperiencePointsView + { + [SerializeField] + private Slider experiencePointsBar; + + [SerializeField] + private Text experiencePointsText; + + public void AddExperiencePoints(float value) + { + if (experiencePointsBar != null) + { + experiencePointsBar.value += value; + } + + UpdateExperiencePercentage(); + } + + public void SetExperiencePoints(float value) + { + if (experiencePointsBar != null) + { + experiencePointsBar.value = value; + } + + UpdateExperiencePercentage(); + } + + public void SetMaxExperiencePoints(float value) + { + if (experiencePointsBar != null) + { + experiencePointsBar.maxValue = value; + } + + SetZeroExperiencePercentage(); + } + + private float GetExperiencePoints() + { + if (experiencePointsBar == null) + { + return 0; + } + + return experiencePointsBar.value; + } + + private float GetMaxExperiencePoints() + { + if (experiencePointsBar == null) + { + return 0; + } + + return experiencePointsBar.maxValue; + } + + private void SetZeroExperiencePercentage() + { + if (experiencePointsText != null) + { + experiencePointsText.text = "0" + "%" + " " + "EXP"; + } + } + + private void UpdateExperiencePercentage() + { + if (experiencePointsText != null) + { + var value = GetExperiencePoints(); + var maxValue = GetMaxExperiencePoints(); + var percentage = CalculateExperiencePercentage(value, maxValue); + + experiencePointsText.text = percentage + "%" + " " + "EXP"; + } + } + + private float CalculateExperiencePercentage(float value, float maxValue) + { + return (float)Math.Round(value / maxValue * 100f, 2); + } + } +} \ No newline at end of file diff --git a/src/maple-fighters/Assets/Maple Fighters/Scripts/UI/PlayerData/Window/PlayerExperiencePointsBar.cs.meta b/src/maple-fighters/Assets/Maple Fighters/Scripts/UI/PlayerData/Window/PlayerExperiencePointsBar.cs.meta new file mode 100644 index 000000000..8b26f6734 --- /dev/null +++ b/src/maple-fighters/Assets/Maple Fighters/Scripts/UI/PlayerData/Window/PlayerExperiencePointsBar.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 04329f8d920f2428da0cbc80d5b5ef7c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: