Unified health module & added health points

This commit is contained in:
Alicja 2022-11-14 22:22:08 +01:00
parent 3bb135c3fe
commit 2e2aae16f8
7 changed files with 784 additions and 15 deletions

View File

@ -21,11 +21,12 @@ public class NewGame : MonoBehaviour
PlayerPrefs.SetFloat("exp", 0); PlayerPrefs.SetFloat("exp", 0);
PlayerPrefs.SetInt("lvl", 1); PlayerPrefs.SetInt("lvl", 1);
PlayerPrefs.SetFloat("maxExp", 10); PlayerPrefs.SetFloat("maxExp", 10);
string name = "none"; string name = "none";
PlayerPrefs.SetString("name", name); PlayerPrefs.SetString("name", name);
//int isQuest = 1; int isQuest = 1;
//PlayerPrefs.SetInt("lumberjack", isQuest); PlayerPrefs.SetInt("lumberjack", isQuest);
/* /*
int isKilled = 0; int isKilled = 0;
@ -37,7 +38,8 @@ public class NewGame : MonoBehaviour
*/ */
float health = 10.0f; float health = 10.0f;
PlayerPrefs.SetFloat("health", health); PlayerPrefs.SetFloat("maxHealth", 10);
PlayerPrefs.SetFloat("health", 10);
//PlayerPrefs.SetInt("continued", 0); //PlayerPrefs.SetInt("continued", 0);
@ -47,6 +49,11 @@ public class NewGame : MonoBehaviour
PlayerPrefs.SetInt("pickaxe", 0); PlayerPrefs.SetInt("pickaxe", 0);
PlayerPrefs.SetInt("healthPoints", 0);
PlayerPrefs.SetInt("defensePoints", 0);
PlayerPrefs.SetInt("StrengthPoints", 0);
PlayerPrefs.SetInt("IntelligencePoints", 0);
OnMapAppearanceMethod.Gateway = OnMapAppearanceMethodEnum.NewGame; OnMapAppearanceMethod.Gateway = OnMapAppearanceMethodEnum.NewGame;
} }
} }

View File

@ -126885,6 +126885,7 @@ RectTransform:
- {fileID: 995873014} - {fileID: 995873014}
- {fileID: 629210859} - {fileID: 629210859}
- {fileID: 887555715} - {fileID: 887555715}
- {fileID: 1192151690}
m_Father: {fileID: 526662798} m_Father: {fileID: 526662798}
m_RootOrder: 12 m_RootOrder: 12
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@ -188723,6 +188724,8 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
slider: {fileID: 720530843} slider: {fileID: 720530843}
maxHealth: 0
health: 0
--- !u!114 &720530843 --- !u!114 &720530843
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -239677,6 +239680,99 @@ SpriteRenderer:
m_WasSpriteAssigned: 1 m_WasSpriteAssigned: 1
m_MaskInteraction: 0 m_MaskInteraction: 0
m_SpriteSortPoint: 0 m_SpriteSortPoint: 0
--- !u!1 &1192151689
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1192151690}
- component: {fileID: 1192151693}
- component: {fileID: 1192151692}
- component: {fileID: 1192151691}
m_Layer: 5
m_Name: GameObject
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1192151690
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1192151689}
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: 182438712}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 40, y: 15}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1192151691
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1192151689}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 94d665a2e8eadda47b5a74e24315f188, type: 3}
m_Name:
m_EditorClassIdentifier:
displayText: {fileID: 1192151692}
--- !u!114 &1192151692
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1192151689}
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: 12800000, guid: f00af03777ec0764c9988b7276259e03, type: 2}
m_FontSize: 0
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 0
m_MaxSize: 40
m_Alignment: 4
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text:
--- !u!222 &1192151693
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1192151689}
m_CullTransparentMesh: 1
--- !u!1 &1193502344 --- !u!1 &1193502344
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@ -1021,6 +1021,114 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 84519187} m_GameObject: {fileID: 84519187}
m_CullTransparentMesh: 1 m_CullTransparentMesh: 1
--- !u!1 &88145926
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 88145927}
- component: {fileID: 88145932}
- component: {fileID: 88145931}
- component: {fileID: 88145929}
- component: {fileID: 88145928}
m_Layer: 5
m_Name: no
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &88145927
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 88145926}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 2.5, y: 2.5, z: 1}
m_Children: []
m_Father: {fileID: 1464669569}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: -199, y: -20}
m_SizeDelta: {x: 89.3916, y: 37}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &88145928
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 88145926}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: a7c996be5c675ec4eb062e7ae1509118, type: 3}
m_Name:
m_EditorClassIdentifier:
textEnglish: Defense
textPolish: Obrona
displayText: {fileID: 88145931}
--- !u!114 &88145929
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 88145926}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 48a2ec1fec857c946ae3ae8e69b29562, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!114 &88145931
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 88145926}
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: 0.63529414, g: 0.44705886, b: 0.2901961, 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: 12800000, guid: 6b506a7e42917d6489d0e806d6b4f62d, type: 2}
m_FontSize: 0
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 0
m_MaxSize: 40
m_Alignment: 4
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text:
--- !u!222 &88145932
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 88145926}
m_CullTransparentMesh: 1
--- !u!1 &131599442 --- !u!1 &131599442
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -1680,6 +1788,7 @@ RectTransform:
- {fileID: 1751060206} - {fileID: 1751060206}
- {fileID: 440573953} - {fileID: 440573953}
- {fileID: 3269899} - {fileID: 3269899}
- {fileID: 1464669569}
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 4 m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@ -25041,6 +25150,8 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
slider: {fileID: 378577489} slider: {fileID: 378577489}
maxHealth: 0
health: 0
--- !u!114 &378577489 --- !u!114 &378577489
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -35601,6 +35712,142 @@ Transform:
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 11 m_RootOrder: 11
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &708386335
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 708386336}
- component: {fileID: 708386343}
- component: {fileID: 708386342}
- component: {fileID: 708386340}
- component: {fileID: 708386339}
- component: {fileID: 708386338}
- component: {fileID: 708386337}
m_Layer: 5
m_Name: yes
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &708386336
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 708386335}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 2.5, y: 2.5, z: 1}
m_Children: []
m_Father: {fileID: 1464669569}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: -201, y: 104}
m_SizeDelta: {x: 89.3916, y: 34.5098}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &708386337
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 708386335}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: a7c996be5c675ec4eb062e7ae1509118, type: 3}
m_Name:
m_EditorClassIdentifier:
textEnglish: Health
textPolish: Zycie
displayText: {fileID: 708386342}
--- !u!114 &708386338
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 708386335}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f8dbef2798cc8064f86e56d2bc02d2fa, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!114 &708386339
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 708386335}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c457960c7d486d346910a6b3fa90380e, type: 3}
m_Name:
m_EditorClassIdentifier:
mainCh: {fileID: 0}
maxHealth: {fileID: 0}
--- !u!114 &708386340
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 708386335}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 48a2ec1fec857c946ae3ae8e69b29562, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!114 &708386342
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 708386335}
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: 0.63529414, g: 0.44705886, b: 0.2901961, 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: 12800000, guid: 6b506a7e42917d6489d0e806d6b4f62d, type: 2}
m_FontSize: 0
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 0
m_MaxSize: 40
m_Alignment: 4
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text:
--- !u!222 &708386343
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 708386335}
m_CullTransparentMesh: 1
--- !u!1 &721418781 --- !u!1 &721418781
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -39205,6 +39452,168 @@ Transform:
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 7 m_RootOrder: 7
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1177353679
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1177353680}
- component: {fileID: 1177353684}
- component: {fileID: 1177353683}
- component: {fileID: 1177353682}
- component: {fileID: 1177353681}
m_Layer: 5
m_Name: Button
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1177353680
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1177353679}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 2, z: 1}
m_Children: []
m_Father: {fileID: 1464669569}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: -19, y: 102}
m_SizeDelta: {x: 50, y: 30}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1177353681
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1177353679}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 840a82f054869244b832426e6b6022bd, type: 3}
m_Name:
m_EditorClassIdentifier:
walkSpeed: 4
Panel: {fileID: 0}
dmgParticleSystem: {fileID: 0}
healthBar: {fileID: 0}
lvlUp: 0
test: 0
currentHealth: 0
maxHealth: 0
healthPoints: 0
defensePoints: 0
strengthPoints: 0
intelligencePoints: 0
exp: 0
lvl: 0
maxExp: 0
levelBar: {fileID: 0}
minPlayerExp: {fileID: 0}
--- !u!114 &1177353682
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1177353679}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, 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: 1
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: 1177353683}
m_OnClick:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 1177353681}
m_TargetAssemblyTypeName: Player, Assembly-CSharp
m_MethodName: AddHealthPoint
m_Mode: 1
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
--- !u!114 &1177353683
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1177353679}
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: 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_Sprite: {fileID: 21300000, guid: 7ed2e1a0c8b345f45ac3e8e6530ad829, type: 3}
m_Type: 0
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!222 &1177353684
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1177353679}
m_CullTransparentMesh: 1
--- !u!1 &1193056560 --- !u!1 &1193056560
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -41364,6 +41773,84 @@ MonoBehaviour:
m_StringArgument: m_StringArgument:
m_BoolArgument: 0 m_BoolArgument: 0
m_CallState: 2 m_CallState: 2
--- !u!1 &1464669568
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1464669569}
- component: {fileID: 1464669571}
- component: {fileID: 1464669570}
m_Layer: 5
m_Name: AbilitiesPanel
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
--- !u!224 &1464669569
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1464669568}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0.7, y: 0.7, z: 1}
m_Children:
- {fileID: 708386336}
- {fileID: 88145927}
- {fileID: 1177353680}
m_Father: {fileID: 184083800}
m_RootOrder: 15
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!114 &1464669570
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1464669568}
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: 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_Sprite: {fileID: 21300000, guid: bb6d69d159de99e469018e593172730d, type: 3}
m_Type: 0
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!222 &1464669571
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1464669568}
m_CullTransparentMesh: 1
--- !u!1 &1467420219 --- !u!1 &1467420219
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@ -24197,6 +24197,8 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
slider: {fileID: 505800832} slider: {fileID: 505800832}
maxHealth: 0
health: 0
--- !u!114 &505800832 --- !u!114 &505800832
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -36933,6 +36935,7 @@ RectTransform:
- {fileID: 23544963} - {fileID: 23544963}
- {fileID: 1329746425} - {fileID: 1329746425}
- {fileID: 1444357770} - {fileID: 1444357770}
- {fileID: 2126040853}
m_Father: {fileID: 41323702} m_Father: {fileID: 41323702}
m_RootOrder: 12 m_RootOrder: 12
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@ -37981,6 +37984,99 @@ RectTransform:
m_AnchoredPosition: {x: 0, y: 0} m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0} m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &2126040852
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2126040853}
- component: {fileID: 2126040856}
- component: {fileID: 2126040855}
- component: {fileID: 2126040854}
m_Layer: 5
m_Name: GameObject
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &2126040853
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2126040852}
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: 1871643637}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 40, y: 15}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &2126040854
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2126040852}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 94d665a2e8eadda47b5a74e24315f188, type: 3}
m_Name:
m_EditorClassIdentifier:
displayText: {fileID: 2126040855}
--- !u!114 &2126040855
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2126040852}
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: 12800000, guid: f00af03777ec0764c9988b7276259e03, type: 2}
m_FontSize: 0
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 0
m_MaxSize: 40
m_Alignment: 4
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text:
--- !u!222 &2126040856
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2126040852}
m_CullTransparentMesh: 1
--- !u!1 &2141892240 --- !u!1 &2141892240
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@ -6,15 +6,27 @@ using UnityEngine.UI;
public class HealthBar : MonoBehaviour public class HealthBar : MonoBehaviour
{ {
public Slider slider; public Slider slider;
public float maxHealth;
public float health;
public void SetMaxHealth(float health) public void SetMaxHealth(float health)
{ {
slider.maxValue = health;
slider.value = health; maxHealth = PlayerPrefs.GetFloat("maxHealth");
slider.maxValue = maxHealth;
} }
public void SetHealth(float health) //public void SetHealth(float health)
//{
// slider.value = health;
//}
void Update()
{ {
maxHealth = PlayerPrefs.GetFloat("maxHealth");
health = PlayerPrefs.GetFloat("health");
slider.maxValue = maxHealth;
slider.value = health; slider.value = health;
//SetExp(exp);
} }
} }

View File

@ -16,8 +16,6 @@ public class Player : MonoBehaviour
private bool inRange = false; private bool inRange = false;
public ParticleSystem dmgParticleSystem; public ParticleSystem dmgParticleSystem;
public FloatValue maxHealth;
public float currentHealth = 10;
public HealthBar healthBar; public HealthBar healthBar;
private static bool attackSword; private static bool attackSword;
@ -37,6 +35,13 @@ public class Player : MonoBehaviour
private bool canWalk = true; private bool canWalk = true;
public float currentHealth;
public float maxHealth;
public int healthPoints;
public int defensePoints;
public int strengthPoints;
public int intelligencePoints;
public float exp; public float exp;
public int lvl; public int lvl;
@ -73,8 +78,8 @@ public class Player : MonoBehaviour
} }
rb = gameObject.GetComponent<Rigidbody2D>(); rb = gameObject.GetComponent<Rigidbody2D>();
myAnimator = GetComponent<Animator>(); myAnimator = GetComponent<Animator>();
healthBar.SetMaxHealth(maxHealth.initialValue); //healthBar.SetMaxHealth(maxHealth.initialValue);
healthBar.SetHealth(currentHealth); //healthBar.SetHealth(currentHealth);
//levelBar.SetStartExp(minPlayerExp.initialValue); //levelBar.SetStartExp(minPlayerExp.initialValue);
//levelBar.SetExp(exp); //levelBar.SetExp(exp);
walkSpeed = 4f; walkSpeed = 4f;
@ -123,8 +128,9 @@ public class Player : MonoBehaviour
public void TakeDamage(float damage, bool isPanelEnabled = true) public void TakeDamage(float damage, bool isPanelEnabled = true)
{ {
currentHealth = PlayerPrefs.GetFloat("health");
currentHealth = currentHealth - damage; currentHealth = currentHealth - damage;
healthBar.SetHealth(currentHealth); PlayerPrefs.SetFloat("health", currentHealth);
var em = dmgParticleSystem.emission; var em = dmgParticleSystem.emission;
em.enabled = true; em.enabled = true;
@ -204,6 +210,11 @@ public class Player : MonoBehaviour
lvlUp = false; lvlUp = false;
} }
ManageHealth();
ManageDefense();
ManageIntelligence();
ManageStrength();
if (canWalk == true) if (canWalk == true)
{ {
@ -237,15 +248,17 @@ public class Player : MonoBehaviour
startRegen = true; startRegen = true;
} }
currentHealth = PlayerPrefs.GetFloat("health");
maxHealth = PlayerPrefs.GetFloat("maxHealth");
if (startRegen == true) if (startRegen == true)
{ {
timerTick += Time.deltaTime; timerTick += Time.deltaTime;
if (timerTick >= waitTick) if (timerTick >= waitTick)
{ {
if (currentHealth < 10) if (currentHealth < maxHealth)
{ {
currentHealth = currentHealth + 1; currentHealth = currentHealth + 1;
healthBar.SetHealth(currentHealth); PlayerPrefs.SetFloat("health", currentHealth);
timerTick = 0f; timerTick = 0f;
} }
} }
@ -254,6 +267,7 @@ public class Player : MonoBehaviour
PlayerPrefs.SetFloat("exp", exp); PlayerPrefs.SetFloat("exp", exp);
PlayerPrefs.SetInt("lvl", lvl); PlayerPrefs.SetInt("lvl", lvl);
PlayerPrefs.SetFloat("maxExp", maxExp); PlayerPrefs.SetFloat("maxExp", maxExp);
PlayerPrefs.SetFloat("maxHealth", maxHealth);
} }
HandleInput(); HandleInput();
@ -284,6 +298,7 @@ public class Player : MonoBehaviour
public void SaveCheckpoint() public void SaveCheckpoint()
{ {
currentHealth = PlayerPrefs.GetFloat("health");
PlayerPrefs.SetFloat("health-S", currentHealth); PlayerPrefs.SetFloat("health-S", currentHealth);
PlayerPrefs.SetFloat("exp-S", exp); PlayerPrefs.SetFloat("exp-S", exp);
PlayerPrefs.SetInt("lvl-S", lvl); PlayerPrefs.SetInt("lvl-S", lvl);
@ -291,22 +306,72 @@ public class Player : MonoBehaviour
public void ManageHealth() public void ManageHealth()
{ {
healthPoints = PlayerPrefs.GetInt("healthPoints");
if (healthPoints == 0)
{
PlayerPrefs.SetFloat("maxHealth", 10);
}
else if (healthPoints == 1)
{
PlayerPrefs.SetFloat("maxHealth", 12);
}
else if (healthPoints == 2)
{
PlayerPrefs.SetFloat("maxHealth", 15);
}
else if (healthPoints == 3)
{
PlayerPrefs.SetFloat("maxHealth", 20);
}
}
public void AddHealthPoint()
{
healthPoints = PlayerPrefs.GetInt("healthPoints");
healthPoints = healthPoints + 1;
PlayerPrefs.SetInt("healthPoints", healthPoints);
} }
public void ManageStrength() public void ManageStrength()
{ {
strengthPoints = PlayerPrefs.GetInt("strengthPoints");
}
public void AddStrengthPoint()
{
strengthPoints = PlayerPrefs.GetInt("strengthPoints");
strengthPoints = strengthPoints + 1;
PlayerPrefs.SetInt("strengthPoints", strengthPoints);
} }
public void ManageDefense() public void ManageDefense()
{ {
defensePoints = PlayerPrefs.GetInt("defensePoints");
}
public void AddDefensePoint()
{
defensePoints = PlayerPrefs.GetInt("defensePoints");
defensePoints = defensePoints + 1;
PlayerPrefs.SetInt("defensePoitns", defensePoints);
}
public void ManageIntelligence()
{
intelligencePoints = PlayerPrefs.GetInt("intelligencePoints");
}
public void AddIntelligencePoint()
{
intelligencePoints = PlayerPrefs.GetInt("intelligencePoints");
intelligencePoints = intelligencePoints + 1;
PlayerPrefs.SetInt("intelligencePoitns", intelligencePoints);
} }
public void LevelUpPopUp() public void LevelUpPopUp()
{ {
healthPoints = PlayerPrefs.GetInt("healthPoints");
} }

View File

@ -9,11 +9,17 @@ EditorUserSettings:
value: 22424703114646680e0b0227036c7c1100123d24383a273e2e2c5326ece92021 value: 22424703114646680e0b0227036c7c1100123d24383a273e2e2c5326ece92021
flags: 0 flags: 0
RecentlyUsedScenePath-1: RecentlyUsedScenePath-1:
value: 22424703114646680e0b0227036c68190c160a2e042733232867083debf42d value: 22424703114646680e0b0227036c72111f1958072926337e38271427fb
flags: 0 flags: 0
RecentlyUsedScenePath-2: RecentlyUsedScenePath-2:
value: 22424703114646680e0b0227036c6c111b07142f1f2b233e2867083debf42d value: 22424703114646680e0b0227036c6c111b07142f1f2b233e2867083debf42d
flags: 0 flags: 0
RecentlyUsedScenePath-3:
value: 22424703114646680e0b0227036c68190c160a2e042733232867083debf42d
flags: 0
RecentlyUsedScenePath-4:
value: 22424703114646680e0b0227036c70050204112e291f2f2a2c3b1920caef212be7a923e7ee2e26
flags: 0
vcSharedLogLevel: vcSharedLogLevel:
value: 0d5e400f0650 value: 0d5e400f0650
flags: 0 flags: 0