From f5e5ba8dfd1f5aed88243daf37444e19ade8a95b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcel=20Ko=C5=82odziej?= Date: Wed, 28 Jun 2023 15:52:42 +0200 Subject: [PATCH 1/4] Get experiance from enemies --- Assets/Game/Stats/BaseStats.cs | 30 +++++- .../Stats}/ExperianceDisplay.cs | 2 +- .../Stats}/ExperianceDisplay.cs.meta | 0 Assets/Game/Stats/Progression.cs | 10 ++ Assets/Game/Stats/Stats.cs | 3 +- Assets/Game/Weapons/Resources/Sword.asset | 2 +- Assets/Game/Weapons/Resources/Weapon 1.asset | 20 ++++ .../Weapons/Resources/Weapon 1.asset.meta | 8 ++ Assets/Game/Weapons/Resources/Weapon.asset | 20 ++++ .../Game/Weapons/Resources/Weapon.asset.meta | 8 ++ Assets/Scenes/Sandbox/SampleScene.unity | 100 ++++++++++++++---- Assets/Scenes/Sandbox/SampleScene2.unity | 95 ++++++++++++++++- Assets/Scripts/Control/AIController.cs | 3 - Assets/Scripts/Core/Progression.asset | 3 +- 14 files changed, 273 insertions(+), 31 deletions(-) rename Assets/{Scripts/Attribiutes => Game/Stats}/ExperianceDisplay.cs (94%) rename Assets/{Scripts/Attribiutes => Game/Stats}/ExperianceDisplay.cs.meta (100%) create mode 100644 Assets/Game/Weapons/Resources/Weapon 1.asset create mode 100644 Assets/Game/Weapons/Resources/Weapon 1.asset.meta create mode 100644 Assets/Game/Weapons/Resources/Weapon.asset create mode 100644 Assets/Game/Weapons/Resources/Weapon.asset.meta diff --git a/Assets/Game/Stats/BaseStats.cs b/Assets/Game/Stats/BaseStats.cs index d7a2343..475270c 100644 --- a/Assets/Game/Stats/BaseStats.cs +++ b/Assets/Game/Stats/BaseStats.cs @@ -8,16 +8,40 @@ namespace RPG.Stats public class BaseStats : MonoBehaviour { [Range(1, 99)] - [SerializeField] int currentLevel = 1; + [SerializeField] int startingLevel = 1; [SerializeField] CharacterClass characterClass; [SerializeField] Progression progression = null; + private void Update() { + if (gameObject.tag == "Player") + { + print(GetLevel()); + } + } + public float GetStat(Stat stat) { - return progression.GetStat(stat, characterClass, currentLevel); + return progression.GetStat(stat, characterClass, GetLevel()); } + public int GetLevel() + { + Experiance experiance = GetComponent(); + if (experiance == null) return startingLevel; + float currentXP = GetComponent().GetPoints(); - } + int penultimateLevel = progression.GetLevels(Stat.ExperianceToLevelUp, characterClass); + for (int level = 1; level <= penultimateLevel; level++) + { + float XPToLevelUP = progression.GetStat(Stat.ExperianceToLevelUp, characterClass, level); + if (XPToLevelUP > currentXP) + { + return level; + } + } + return penultimateLevel + 1; + + } + } } diff --git a/Assets/Scripts/Attribiutes/ExperianceDisplay.cs b/Assets/Game/Stats/ExperianceDisplay.cs similarity index 94% rename from Assets/Scripts/Attribiutes/ExperianceDisplay.cs rename to Assets/Game/Stats/ExperianceDisplay.cs index 0bedbdc..7a9bf8b 100644 --- a/Assets/Scripts/Attribiutes/ExperianceDisplay.cs +++ b/Assets/Game/Stats/ExperianceDisplay.cs @@ -5,7 +5,7 @@ using UnityEngine; using UnityEngine.UI; -namespace RPG.Attribiutes +namespace RPG.Stats { public class ExperianceDisplay : MonoBehaviour diff --git a/Assets/Scripts/Attribiutes/ExperianceDisplay.cs.meta b/Assets/Game/Stats/ExperianceDisplay.cs.meta similarity index 100% rename from Assets/Scripts/Attribiutes/ExperianceDisplay.cs.meta rename to Assets/Game/Stats/ExperianceDisplay.cs.meta diff --git a/Assets/Game/Stats/Progression.cs b/Assets/Game/Stats/Progression.cs index c760abd..0ba5a55 100644 --- a/Assets/Game/Stats/Progression.cs +++ b/Assets/Game/Stats/Progression.cs @@ -43,6 +43,16 @@ public float GetStat(Stat stat, CharacterClass characterClass, int level) } + + public int GetLevels(Stat stat, CharacterClass characterClass) + { + BuildLookup(); + + float[] levels = lookupTable[characterClass][stat]; + return levels.Length; + + } + private void BuildLookup() { if (lookupTable != null) return; diff --git a/Assets/Game/Stats/Stats.cs b/Assets/Game/Stats/Stats.cs index a597cbc..d11ab63 100644 --- a/Assets/Game/Stats/Stats.cs +++ b/Assets/Game/Stats/Stats.cs @@ -8,6 +8,7 @@ namespace RPG.Stats public enum Stat { Health, - ExpieranceReward + ExpieranceReward, + ExperianceToLevelUp, } } \ No newline at end of file diff --git a/Assets/Game/Weapons/Resources/Sword.asset b/Assets/Game/Weapons/Resources/Sword.asset index 82c12f3..7c63b17 100644 --- a/Assets/Game/Weapons/Resources/Sword.asset +++ b/Assets/Game/Weapons/Resources/Sword.asset @@ -14,7 +14,7 @@ MonoBehaviour: m_EditorClassIdentifier: Assembly-CSharp:RPG.Combat:Weapon animatorOverride: {fileID: 22100000, guid: 51afcf0b6656349409f7076aa44bb544, type: 2} equpipedPrefab: {fileID: 6676521290224804715, guid: 6ede0ff8790d57242917414e790eeeb3, type: 3} - weaponRange: 10 + weaponRange: 3 weaponDamage: 30 isRightHanded: 1 projectile: {fileID: 0} diff --git a/Assets/Game/Weapons/Resources/Weapon 1.asset b/Assets/Game/Weapons/Resources/Weapon 1.asset new file mode 100644 index 0000000..a42ffbd --- /dev/null +++ b/Assets/Game/Weapons/Resources/Weapon 1.asset @@ -0,0 +1,20 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 724db26ffd31b204c8f1c4d007f77a07, type: 3} + m_Name: Weapon 1 + m_EditorClassIdentifier: + animatorOverride: {fileID: 0} + equpipedPrefab: {fileID: 0} + weaponRange: 2 + weaponDamage: 5 + isRightHanded: 1 + projectile: {fileID: 0} diff --git a/Assets/Game/Weapons/Resources/Weapon 1.asset.meta b/Assets/Game/Weapons/Resources/Weapon 1.asset.meta new file mode 100644 index 0000000..e0d49ae --- /dev/null +++ b/Assets/Game/Weapons/Resources/Weapon 1.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3bb365d97ef2db9469c632bb3caabb3a +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Game/Weapons/Resources/Weapon.asset b/Assets/Game/Weapons/Resources/Weapon.asset new file mode 100644 index 0000000..c984962 --- /dev/null +++ b/Assets/Game/Weapons/Resources/Weapon.asset @@ -0,0 +1,20 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 724db26ffd31b204c8f1c4d007f77a07, type: 3} + m_Name: Weapon + m_EditorClassIdentifier: + animatorOverride: {fileID: 0} + equpipedPrefab: {fileID: 0} + weaponRange: 2 + weaponDamage: 5 + isRightHanded: 1 + projectile: {fileID: 0} diff --git a/Assets/Game/Weapons/Resources/Weapon.asset.meta b/Assets/Game/Weapons/Resources/Weapon.asset.meta new file mode 100644 index 0000000..4d433c5 --- /dev/null +++ b/Assets/Game/Weapons/Resources/Weapon.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 6be5cfce1b35989458e939071a280dff +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scenes/Sandbox/SampleScene.unity b/Assets/Scenes/Sandbox/SampleScene.unity index 048390d..63dfa79 100644 --- a/Assets/Scenes/Sandbox/SampleScene.unity +++ b/Assets/Scenes/Sandbox/SampleScene.unity @@ -1552,7 +1552,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 6231009992145329496, guid: 7ff55016d2ccea44c9303bfcae108e6a, type: 3} propertyPath: m_IsActive - value: 1 + value: 0 objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 7ff55016d2ccea44c9303bfcae108e6a, type: 3} @@ -2857,17 +2857,29 @@ PrefabInstance: propertyPath: m_Follow value: objectReference: {fileID: 1804870737} + - target: {fileID: 726594926844090024, guid: c1f5a3649aa42f2488c5fb745bdd5a1b, type: 3} + propertyPath: m_Height + value: 2.12 + objectReference: {fileID: 0} + - target: {fileID: 726594926844090024, guid: c1f5a3649aa42f2488c5fb745bdd5a1b, type: 3} + propertyPath: m_Radius + value: 0.29 + objectReference: {fileID: 0} + - target: {fileID: 726594926844090024, guid: c1f5a3649aa42f2488c5fb745bdd5a1b, type: 3} + propertyPath: m_Center.y + value: 1 + objectReference: {fileID: 0} - target: {fileID: 2283234957600463390, guid: c1f5a3649aa42f2488c5fb745bdd5a1b, type: 3} propertyPath: m_LocalPosition.x - value: -51.04 + value: -20.58 objectReference: {fileID: 0} - target: {fileID: 2283234957600463390, guid: c1f5a3649aa42f2488c5fb745bdd5a1b, type: 3} propertyPath: m_LocalPosition.y - value: 5.16 + value: 6.44 objectReference: {fileID: 0} - target: {fileID: 2283234957600463390, guid: c1f5a3649aa42f2488c5fb745bdd5a1b, type: 3} propertyPath: m_LocalPosition.z - value: 170.05 + value: 131.551 objectReference: {fileID: 0} - target: {fileID: 2764833630395926868, guid: c1f5a3649aa42f2488c5fb745bdd5a1b, type: 3} propertyPath: m_RootOrder @@ -2923,47 +2935,95 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 4904399729703606452, guid: c1f5a3649aa42f2488c5fb745bdd5a1b, type: 3} propertyPath: m_CameraDistance - value: 42 + value: 43.31849 + objectReference: {fileID: 0} + - target: {fileID: 4904399729703606452, guid: c1f5a3649aa42f2488c5fb745bdd5a1b, type: 3} + propertyPath: m_TrackedObjectOffset.x + value: -0.09411963 + objectReference: {fileID: 0} + - target: {fileID: 4904399729703606452, guid: c1f5a3649aa42f2488c5fb745bdd5a1b, type: 3} + propertyPath: m_TrackedObjectOffset.y + value: -2.085551 + objectReference: {fileID: 0} + - target: {fileID: 4904399729703606452, guid: c1f5a3649aa42f2488c5fb745bdd5a1b, type: 3} + propertyPath: m_TrackedObjectOffset.z + value: 0.1587774 objectReference: {fileID: 0} - target: {fileID: 5584080860306864857, guid: c1f5a3649aa42f2488c5fb745bdd5a1b, type: 3} propertyPath: m_LocalPosition.x - value: -15.119057 + value: -38.580402 objectReference: {fileID: 0} - target: {fileID: 5584080860306864857, guid: c1f5a3649aa42f2488c5fb745bdd5a1b, type: 3} propertyPath: m_LocalPosition.y - value: 25.984938 + value: 23.786547 objectReference: {fileID: 0} - target: {fileID: 5584080860306864857, guid: c1f5a3649aa42f2488c5fb745bdd5a1b, type: 3} propertyPath: m_LocalPosition.z - value: 176.37772 + value: 166.03612 objectReference: {fileID: 0} - target: {fileID: 5584080860306864857, guid: c1f5a3649aa42f2488c5fb745bdd5a1b, type: 3} propertyPath: m_LocalRotation.w - value: 0.6237581 + value: 0.23273543 objectReference: {fileID: 0} - target: {fileID: 5584080860306864857, guid: c1f5a3649aa42f2488c5fb745bdd5a1b, type: 3} propertyPath: m_LocalRotation.x - value: 0.17732428 + value: 0.060491394 objectReference: {fileID: 0} - target: {fileID: 5584080860306864857, guid: c1f5a3649aa42f2488c5fb745bdd5a1b, type: 3} propertyPath: m_LocalRotation.y - value: -0.7373927 + value: 0.94424284 objectReference: {fileID: 0} - target: {fileID: 5584080860306864857, guid: c1f5a3649aa42f2488c5fb745bdd5a1b, type: 3} propertyPath: m_LocalRotation.z - value: 0.18903442 + value: -0.22490102 + objectReference: {fileID: 0} + - target: {fileID: 7392693103043053375, guid: c1f5a3649aa42f2488c5fb745bdd5a1b, type: 3} + propertyPath: m_DeadZoneWidth + value: 0.01 + objectReference: {fileID: 0} + - target: {fileID: 7392693103043053375, guid: c1f5a3649aa42f2488c5fb745bdd5a1b, type: 3} + propertyPath: m_DeadZoneHeight + value: 0.03617591 objectReference: {fileID: 0} - target: {fileID: 8155141456973853842, guid: c1f5a3649aa42f2488c5fb745bdd5a1b, type: 3} propertyPath: m_LocalPosition.x - value: -15.119057 + value: -38.580402 objectReference: {fileID: 0} - target: {fileID: 8155141456973853842, guid: c1f5a3649aa42f2488c5fb745bdd5a1b, type: 3} propertyPath: m_LocalPosition.y - value: 25.984938 + value: 23.786547 objectReference: {fileID: 0} - target: {fileID: 8155141456973853842, guid: c1f5a3649aa42f2488c5fb745bdd5a1b, type: 3} propertyPath: m_LocalPosition.z - value: 176.37772 + value: 166.03612 + objectReference: {fileID: 0} + - target: {fileID: 8155141456973853842, guid: c1f5a3649aa42f2488c5fb745bdd5a1b, type: 3} + propertyPath: m_LocalRotation.w + value: 0.23273543 + objectReference: {fileID: 0} + - target: {fileID: 8155141456973853842, guid: c1f5a3649aa42f2488c5fb745bdd5a1b, type: 3} + propertyPath: m_LocalRotation.x + value: 0.0604914 + objectReference: {fileID: 0} + - target: {fileID: 8155141456973853842, guid: c1f5a3649aa42f2488c5fb745bdd5a1b, type: 3} + propertyPath: m_LocalRotation.y + value: 0.9442429 + objectReference: {fileID: 0} + - target: {fileID: 8155141456973853842, guid: c1f5a3649aa42f2488c5fb745bdd5a1b, type: 3} + propertyPath: m_LocalRotation.z + value: -0.22490105 + objectReference: {fileID: 0} + - target: {fileID: 8155141456973853842, guid: c1f5a3649aa42f2488c5fb745bdd5a1b, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 26.929 + objectReference: {fileID: 0} + - target: {fileID: 8155141456973853842, guid: c1f5a3649aa42f2488c5fb745bdd5a1b, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 152.455 + objectReference: {fileID: 0} + - target: {fileID: 8155141456973853842, guid: c1f5a3649aa42f2488c5fb745bdd5a1b, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0.614 objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: c1f5a3649aa42f2488c5fb745bdd5a1b, type: 3} @@ -3496,7 +3556,7 @@ PrefabInstance: objectReference: {fileID: 3326048076889022316} - target: {fileID: 4729995260501095819, guid: 3778d90c82845f948a1ae86a34bdd5ad, type: 3} propertyPath: chaseDistance - value: 10 + value: 11.13 objectReference: {fileID: 0} - target: {fileID: 4729995260501095819, guid: 3778d90c82845f948a1ae86a34bdd5ad, type: 3} propertyPath: wayPointTolerance @@ -3504,7 +3564,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 4729995260501095819, guid: 3778d90c82845f948a1ae86a34bdd5ad, type: 3} propertyPath: patrolSpeedFraction - value: 0.832 + value: 0.635 objectReference: {fileID: 0} - target: {fileID: 4729995260501095819, guid: 3778d90c82845f948a1ae86a34bdd5ad, type: 3} propertyPath: suspictionStateTimer @@ -3556,7 +3616,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 6524986458148225266, guid: 3778d90c82845f948a1ae86a34bdd5ad, type: 3} propertyPath: maxSpeed - value: 3 + value: 6 objectReference: {fileID: 0} - target: {fileID: 6524986458148225266, guid: 3778d90c82845f948a1ae86a34bdd5ad, type: 3} propertyPath: speedFraction @@ -3570,6 +3630,10 @@ PrefabInstance: propertyPath: m_Name value: Enemy (3) objectReference: {fileID: 0} + - target: {fileID: 6524986458148225269, guid: 3778d90c82845f948a1ae86a34bdd5ad, type: 3} + propertyPath: m_TagString + value: Untagged + objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 3778d90c82845f948a1ae86a34bdd5ad, type: 3} --- !u!4 &2036165933 stripped diff --git a/Assets/Scenes/Sandbox/SampleScene2.unity b/Assets/Scenes/Sandbox/SampleScene2.unity index 71e0ef0..b7be318 100644 --- a/Assets/Scenes/Sandbox/SampleScene2.unity +++ b/Assets/Scenes/Sandbox/SampleScene2.unity @@ -797,7 +797,7 @@ PrefabInstance: m_Modifications: - target: {fileID: 4932007361853871578, guid: 3b9be960c13452443b384e4b83e48ff8, type: 3} propertyPath: chaseDistance - value: 14.7 + value: 7.38 objectReference: {fileID: 0} - target: {fileID: 6977762894504957390, guid: 3b9be960c13452443b384e4b83e48ff8, type: 3} propertyPath: uniqueIdentifier @@ -973,6 +973,95 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: c9f0b606b135dec4b9d53a72428090d6, type: 3} m_Name: m_EditorClassIdentifier: +--- !u!1001 &845696325 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 2036427476403381886, guid: 501710d4964a8c24ea184629691c1b0d, type: 3} + propertyPath: m_LocalPosition.x + value: -21.64 + objectReference: {fileID: 0} + - target: {fileID: 2036427476403381886, guid: 501710d4964a8c24ea184629691c1b0d, type: 3} + propertyPath: m_LocalPosition.z + value: -3.29 + objectReference: {fileID: 0} + - target: {fileID: 2036427476996929585, guid: 501710d4964a8c24ea184629691c1b0d, type: 3} + propertyPath: m_LocalPosition.x + value: -7.63 + objectReference: {fileID: 0} + - target: {fileID: 2036427476996929585, guid: 501710d4964a8c24ea184629691c1b0d, type: 3} + propertyPath: m_LocalPosition.z + value: -10.91 + objectReference: {fileID: 0} + - target: {fileID: 2036427477255367078, guid: 501710d4964a8c24ea184629691c1b0d, type: 3} + propertyPath: m_LocalPosition.x + value: 6.45 + objectReference: {fileID: 0} + - target: {fileID: 2036427477255367078, guid: 501710d4964a8c24ea184629691c1b0d, type: 3} + propertyPath: m_LocalPosition.z + value: -8.29 + objectReference: {fileID: 0} + - target: {fileID: 2036427477293931960, guid: 501710d4964a8c24ea184629691c1b0d, type: 3} + propertyPath: m_Name + value: Patrol Path (1) + objectReference: {fileID: 0} + - target: {fileID: 2036427477293931963, guid: 501710d4964a8c24ea184629691c1b0d, type: 3} + propertyPath: m_RootOrder + value: 11 + objectReference: {fileID: 0} + - target: {fileID: 2036427477293931963, guid: 501710d4964a8c24ea184629691c1b0d, type: 3} + propertyPath: m_LocalPosition.x + value: 400 + objectReference: {fileID: 0} + - target: {fileID: 2036427477293931963, guid: 501710d4964a8c24ea184629691c1b0d, type: 3} + propertyPath: m_LocalPosition.y + value: 1.04 + objectReference: {fileID: 0} + - target: {fileID: 2036427477293931963, guid: 501710d4964a8c24ea184629691c1b0d, type: 3} + propertyPath: m_LocalPosition.z + value: 454.96 + objectReference: {fileID: 0} + - target: {fileID: 2036427477293931963, guid: 501710d4964a8c24ea184629691c1b0d, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 2036427477293931963, guid: 501710d4964a8c24ea184629691c1b0d, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2036427477293931963, guid: 501710d4964a8c24ea184629691c1b0d, type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2036427477293931963, guid: 501710d4964a8c24ea184629691c1b0d, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2036427477293931963, guid: 501710d4964a8c24ea184629691c1b0d, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2036427477293931963, guid: 501710d4964a8c24ea184629691c1b0d, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2036427477293931963, guid: 501710d4964a8c24ea184629691c1b0d, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2036427477845918037, guid: 501710d4964a8c24ea184629691c1b0d, type: 3} + propertyPath: m_LocalPosition.x + value: -6.63 + objectReference: {fileID: 0} + - target: {fileID: 2036427477845918037, guid: 501710d4964a8c24ea184629691c1b0d, type: 3} + propertyPath: m_LocalPosition.z + value: 25 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 501710d4964a8c24ea184629691c1b0d, type: 3} --- !u!1 &956729038 GameObject: m_ObjectHideFlags: 0 @@ -1450,7 +1539,7 @@ PrefabInstance: objectReference: {fileID: 11400000, guid: 62a385bdc0781d5428fadf8b0ce22722, type: 2} - target: {fileID: 2416820501513256478, guid: c1f5a3649aa42f2488c5fb745bdd5a1b, type: 3} propertyPath: currentLevel - value: 4 + value: 1 objectReference: {fileID: 0} - target: {fileID: 2764833630395926868, guid: c1f5a3649aa42f2488c5fb745bdd5a1b, type: 3} propertyPath: m_RootOrder @@ -1863,7 +1952,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 46bfd0b5600e6444eae7b85b8d323dbf, type: 3} m_Name: m_EditorClassIdentifier: - currentLevel: 2 + startingLevel: 1 characterClass: 1 progression: {fileID: 11400000, guid: 62a385bdc0781d5428fadf8b0ce22722, type: 2} --- !u!4 &2111827178 stripped diff --git a/Assets/Scripts/Control/AIController.cs b/Assets/Scripts/Control/AIController.cs index e415a3e..3e08dee 100644 --- a/Assets/Scripts/Control/AIController.cs +++ b/Assets/Scripts/Control/AIController.cs @@ -97,8 +97,6 @@ private void CycleWaypoint() Debug.Log("NEXT POINT "); } - - private void SuspicionBehaviour() { GetComponent().CancelCurrentAction(); @@ -109,7 +107,6 @@ private bool DistanceToPlayer() { return distanceToPlayer < chaseDistance; } - // Called by Unity, when selected private void OnDrawGizmosSelected() { Gizmos.color = Color.blue; diff --git a/Assets/Scripts/Core/Progression.asset b/Assets/Scripts/Core/Progression.asset index 2b3037b..676dd5a 100644 --- a/Assets/Scripts/Core/Progression.asset +++ b/Assets/Scripts/Core/Progression.asset @@ -22,13 +22,14 @@ MonoBehaviour: - 200 - 400 - 800 - - stat: 1 + - stat: 2 levels: - 10 - 20 - 30 - 40 - 50 + - 80 - characterClass: 1 stats: - stat: 0 From 86b52fb178960740e00a960d005211c08f25c563 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcel=20Ko=C5=82odziej?= Date: Wed, 28 Jun 2023 16:13:39 +0200 Subject: [PATCH 2/4] Displaying Level in HUD --- Assets/Game/UI/HUD.prefab | 187 +++++++++++- Assets/Game/Weapons/Resources/Fireball.asset | 2 +- Assets/LevelDisplay.cs | 24 ++ Assets/LevelDisplay.cs.meta | 11 + Assets/Scenes/Sandbox/SampleScene2.unity | 282 +++++++------------ 5 files changed, 318 insertions(+), 188 deletions(-) create mode 100644 Assets/LevelDisplay.cs create mode 100644 Assets/LevelDisplay.cs.meta diff --git a/Assets/Game/UI/HUD.prefab b/Assets/Game/UI/HUD.prefab index fd8d65e..919be0e 100644 --- a/Assets/Game/UI/HUD.prefab +++ b/Assets/Game/UI/HUD.prefab @@ -37,6 +37,8 @@ RectTransform: - {fileID: 5303143757902800311} - {fileID: 3212405848113969374} - {fileID: 2764863217000524077} + - {fileID: 1248502876088977280} + - {fileID: 7473457825007299707} m_Father: {fileID: 0} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -278,7 +280,7 @@ GameObject: - component: {fileID: 6910957907226672325} - component: {fileID: 4652334842134147483} m_Layer: 5 - m_Name: health display enemy + m_Name: health value display enemy m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -346,6 +348,99 @@ MonoBehaviour: m_VerticalOverflow: 0 m_LineSpacing: 1 m_Text: 0 +--- !u!1 &2938666497261058804 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 7473457825007299707} + - component: {fileID: 6782847474946753405} + - component: {fileID: 4197879164845056092} + - component: {fileID: 8709882783579870938} + m_Layer: 5 + m_Name: level value display + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &7473457825007299707 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2938666497261058804} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: -0.00004574286} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 3146261307823422581} + m_RootOrder: 7 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 67.7, y: -66.19998} + m_SizeDelta: {x: 300.5, y: 80.5} + m_Pivot: {x: 0, y: 1} +--- !u!222 &6782847474946753405 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2938666497261058804} + m_CullTransparentMesh: 1 +--- !u!114 &4197879164845056092 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2938666497261058804} + 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: 19 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 1 + m_MaxSize: 69 + m_Alignment: 0 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: 0 +--- !u!114 &8709882783579870938 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2938666497261058804} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fb16ad87191a03644b1e3bb84d6bec25, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!1 &3417064399232934002 GameObject: m_ObjectHideFlags: 0 @@ -439,7 +534,7 @@ GameObject: - component: {fileID: 1110763619663211553} - component: {fileID: 3073569807582732558} m_Layer: 5 - m_Name: experiance value + m_Name: experiance value display m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -519,6 +614,86 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: a66d0aec2fa49fb4193005b67a3d0291, type: 3} m_Name: m_EditorClassIdentifier: +--- !u!1 &7154399015558026681 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1248502876088977280} + - component: {fileID: 1229282356339934735} + - component: {fileID: 5693773772476280115} + m_Layer: 5 + m_Name: level label + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1248502876088977280 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7154399015558026681} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0.000000022351752} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 3146261307823422581} + m_RootOrder: 6 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 0, y: -66.2} + m_SizeDelta: {x: 300.5, y: 80.5} + m_Pivot: {x: 0, y: 1} +--- !u!222 &1229282356339934735 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7154399015558026681} + m_CullTransparentMesh: 1 +--- !u!114 &5693773772476280115 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7154399015558026681} + 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: 19 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 1 + m_MaxSize: 69 + m_Alignment: 0 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: 'Level:' --- !u!1 &8403290956578974668 GameObject: m_ObjectHideFlags: 0 @@ -531,7 +706,7 @@ GameObject: - component: {fileID: 3395662015572587704} - component: {fileID: 2412460760249471213} m_Layer: 5 - m_Name: health display + m_Name: health value display m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -545,7 +720,7 @@ RectTransform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 8403290956578974668} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalPosition: {x: 0, y: 0, z: -0.0014419563} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] @@ -554,7 +729,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 92.062485, y: 0} + m_AnchoredPosition: {x: 0, y: -0} m_SizeDelta: {x: 300.5, y: 80.5} m_Pivot: {x: 0, y: 1} --- !u!222 &3395662015572587704 @@ -598,4 +773,4 @@ MonoBehaviour: m_HorizontalOverflow: 0 m_VerticalOverflow: 0 m_LineSpacing: 1 - m_Text: 'HEALTH:' + m_Text: 0 diff --git a/Assets/Game/Weapons/Resources/Fireball.asset b/Assets/Game/Weapons/Resources/Fireball.asset index 15efa41..bbf16c3 100644 --- a/Assets/Game/Weapons/Resources/Fireball.asset +++ b/Assets/Game/Weapons/Resources/Fireball.asset @@ -15,6 +15,6 @@ MonoBehaviour: animatorOverride: {fileID: 22100000, guid: 59770e51fcef7ad43aed15eebcfc1b9d, type: 2} equpipedPrefab: {fileID: 3860594708924930508, guid: 342291d537d386845819e8d954da64d9, type: 3} weaponRange: 20 - weaponDamage: 5 + weaponDamage: 20 isRightHanded: 1 projectile: {fileID: 3550016555361385736, guid: f033a39ec363b7a40b54d2f7e1514543, type: 3} diff --git a/Assets/LevelDisplay.cs b/Assets/LevelDisplay.cs new file mode 100644 index 0000000..c17098a --- /dev/null +++ b/Assets/LevelDisplay.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using RPG.Stats; +using UnityEngine; +using UnityEngine.UI; + +namespace RPG.Stats +{ + + public class LevelDisplay : MonoBehaviour + { + BaseStats baseStats; + + private void Awake() { + baseStats = GameObject.FindWithTag("Player").GetComponent(); + } + + private void Update() + { + GetComponent().text = String.Format("{0:0}", baseStats.GetLevel()); + } + } +} diff --git a/Assets/LevelDisplay.cs.meta b/Assets/LevelDisplay.cs.meta new file mode 100644 index 0000000..5551b16 --- /dev/null +++ b/Assets/LevelDisplay.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: fb16ad87191a03644b1e3bb84d6bec25 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scenes/Sandbox/SampleScene2.unity b/Assets/Scenes/Sandbox/SampleScene2.unity index b7be318..1fde375 100644 --- a/Assets/Scenes/Sandbox/SampleScene2.unity +++ b/Assets/Scenes/Sandbox/SampleScene2.unity @@ -258,7 +258,7 @@ Transform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 8 + m_RootOrder: 7 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1001 &146274374 PrefabInstance: @@ -502,7 +502,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 2097272214745190213, guid: c5b504a31fb066f41948b6bbfcb64c97, type: 3} propertyPath: m_RootOrder - value: 5 + value: 4 objectReference: {fileID: 0} - target: {fileID: 2097272214745190213, guid: c5b504a31fb066f41948b6bbfcb64c97, type: 3} propertyPath: m_LocalPosition.x @@ -658,7 +658,7 @@ Transform: - {fileID: 570246245} - {fileID: 603861567} m_Father: {fileID: 0} - m_RootOrder: 7 + m_RootOrder: 6 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1001 &500068113 PrefabInstance: @@ -727,7 +727,7 @@ PrefabInstance: m_Modifications: - target: {fileID: 1414075886367445506, guid: 5c28c8e7487321a4fb3834fa28034d89, type: 3} propertyPath: m_RootOrder - value: 2 + value: 1 objectReference: {fileID: 0} - target: {fileID: 1414075886367445506, guid: 5c28c8e7487321a4fb3834fa28034d89, type: 3} propertyPath: m_LocalPosition.x @@ -788,75 +788,6 @@ Transform: m_CorrespondingSourceObject: {fileID: 400000, guid: 9ada23a6ef88d194e832263f906fb0af, type: 3} m_PrefabInstance: {fileID: 181520231} m_PrefabAsset: {fileID: 0} ---- !u!1001 &581343936 -PrefabInstance: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - m_TransformParent: {fileID: 0} - m_Modifications: - - target: {fileID: 4932007361853871578, guid: 3b9be960c13452443b384e4b83e48ff8, type: 3} - propertyPath: chaseDistance - value: 7.38 - objectReference: {fileID: 0} - - target: {fileID: 6977762894504957390, guid: 3b9be960c13452443b384e4b83e48ff8, type: 3} - propertyPath: uniqueIdentifier - value: 2ba04c41-3304-4f4d-864f-ff4bbec5f922 - objectReference: {fileID: 0} - - target: {fileID: 7632396340250342184, guid: 3b9be960c13452443b384e4b83e48ff8, type: 3} - propertyPath: m_IsTrigger - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 8993727228351368283, guid: 3b9be960c13452443b384e4b83e48ff8, type: 3} - propertyPath: m_Name - value: Enemy Swordsman - objectReference: {fileID: 0} - - target: {fileID: 8993727228351368287, guid: 3b9be960c13452443b384e4b83e48ff8, type: 3} - propertyPath: m_RootOrder - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 8993727228351368287, guid: 3b9be960c13452443b384e4b83e48ff8, type: 3} - propertyPath: m_LocalPosition.x - value: 52.65571 - objectReference: {fileID: 0} - - target: {fileID: 8993727228351368287, guid: 3b9be960c13452443b384e4b83e48ff8, type: 3} - propertyPath: m_LocalPosition.y - value: -0.00000023841858 - objectReference: {fileID: 0} - - target: {fileID: 8993727228351368287, guid: 3b9be960c13452443b384e4b83e48ff8, type: 3} - propertyPath: m_LocalPosition.z - value: 31.852596 - objectReference: {fileID: 0} - - target: {fileID: 8993727228351368287, guid: 3b9be960c13452443b384e4b83e48ff8, type: 3} - propertyPath: m_LocalRotation.w - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 8993727228351368287, guid: 3b9be960c13452443b384e4b83e48ff8, type: 3} - propertyPath: m_LocalRotation.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 8993727228351368287, guid: 3b9be960c13452443b384e4b83e48ff8, type: 3} - propertyPath: m_LocalRotation.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 8993727228351368287, guid: 3b9be960c13452443b384e4b83e48ff8, type: 3} - propertyPath: m_LocalRotation.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 8993727228351368287, guid: 3b9be960c13452443b384e4b83e48ff8, type: 3} - propertyPath: m_LocalEulerAnglesHint.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 8993727228351368287, guid: 3b9be960c13452443b384e4b83e48ff8, type: 3} - propertyPath: m_LocalEulerAnglesHint.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 8993727228351368287, guid: 3b9be960c13452443b384e4b83e48ff8, type: 3} - propertyPath: m_LocalEulerAnglesHint.z - value: 0 - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_SourcePrefab: {fileID: 100100000, guid: 3b9be960c13452443b384e4b83e48ff8, type: 3} --- !u!1 &603861564 GameObject: m_ObjectHideFlags: 0 @@ -973,95 +904,6 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: c9f0b606b135dec4b9d53a72428090d6, type: 3} m_Name: m_EditorClassIdentifier: ---- !u!1001 &845696325 -PrefabInstance: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - m_TransformParent: {fileID: 0} - m_Modifications: - - target: {fileID: 2036427476403381886, guid: 501710d4964a8c24ea184629691c1b0d, type: 3} - propertyPath: m_LocalPosition.x - value: -21.64 - objectReference: {fileID: 0} - - target: {fileID: 2036427476403381886, guid: 501710d4964a8c24ea184629691c1b0d, type: 3} - propertyPath: m_LocalPosition.z - value: -3.29 - objectReference: {fileID: 0} - - target: {fileID: 2036427476996929585, guid: 501710d4964a8c24ea184629691c1b0d, type: 3} - propertyPath: m_LocalPosition.x - value: -7.63 - objectReference: {fileID: 0} - - target: {fileID: 2036427476996929585, guid: 501710d4964a8c24ea184629691c1b0d, type: 3} - propertyPath: m_LocalPosition.z - value: -10.91 - objectReference: {fileID: 0} - - target: {fileID: 2036427477255367078, guid: 501710d4964a8c24ea184629691c1b0d, type: 3} - propertyPath: m_LocalPosition.x - value: 6.45 - objectReference: {fileID: 0} - - target: {fileID: 2036427477255367078, guid: 501710d4964a8c24ea184629691c1b0d, type: 3} - propertyPath: m_LocalPosition.z - value: -8.29 - objectReference: {fileID: 0} - - target: {fileID: 2036427477293931960, guid: 501710d4964a8c24ea184629691c1b0d, type: 3} - propertyPath: m_Name - value: Patrol Path (1) - objectReference: {fileID: 0} - - target: {fileID: 2036427477293931963, guid: 501710d4964a8c24ea184629691c1b0d, type: 3} - propertyPath: m_RootOrder - value: 11 - objectReference: {fileID: 0} - - target: {fileID: 2036427477293931963, guid: 501710d4964a8c24ea184629691c1b0d, type: 3} - propertyPath: m_LocalPosition.x - value: 400 - objectReference: {fileID: 0} - - target: {fileID: 2036427477293931963, guid: 501710d4964a8c24ea184629691c1b0d, type: 3} - propertyPath: m_LocalPosition.y - value: 1.04 - objectReference: {fileID: 0} - - target: {fileID: 2036427477293931963, guid: 501710d4964a8c24ea184629691c1b0d, type: 3} - propertyPath: m_LocalPosition.z - value: 454.96 - objectReference: {fileID: 0} - - target: {fileID: 2036427477293931963, guid: 501710d4964a8c24ea184629691c1b0d, type: 3} - propertyPath: m_LocalRotation.w - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 2036427477293931963, guid: 501710d4964a8c24ea184629691c1b0d, type: 3} - propertyPath: m_LocalRotation.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 2036427477293931963, guid: 501710d4964a8c24ea184629691c1b0d, type: 3} - propertyPath: m_LocalRotation.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 2036427477293931963, guid: 501710d4964a8c24ea184629691c1b0d, type: 3} - propertyPath: m_LocalRotation.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 2036427477293931963, guid: 501710d4964a8c24ea184629691c1b0d, type: 3} - propertyPath: m_LocalEulerAnglesHint.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 2036427477293931963, guid: 501710d4964a8c24ea184629691c1b0d, type: 3} - propertyPath: m_LocalEulerAnglesHint.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 2036427477293931963, guid: 501710d4964a8c24ea184629691c1b0d, type: 3} - propertyPath: m_LocalEulerAnglesHint.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 2036427477845918037, guid: 501710d4964a8c24ea184629691c1b0d, type: 3} - propertyPath: m_LocalPosition.x - value: -6.63 - objectReference: {fileID: 0} - - target: {fileID: 2036427477845918037, guid: 501710d4964a8c24ea184629691c1b0d, type: 3} - propertyPath: m_LocalPosition.z - value: 25 - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_SourcePrefab: {fileID: 100100000, guid: 501710d4964a8c24ea184629691c1b0d, type: 3} --- !u!1 &956729038 GameObject: m_ObjectHideFlags: 0 @@ -1094,7 +936,7 @@ Transform: - {fileID: 965412295} - {fileID: 1804631576} m_Father: {fileID: 0} - m_RootOrder: 9 + m_RootOrder: 8 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!4 &965412295 stripped Transform: @@ -1114,7 +956,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 2097272214745190213, guid: c5b504a31fb066f41948b6bbfcb64c97, type: 3} propertyPath: m_RootOrder - value: 6 + value: 5 objectReference: {fileID: 0} - target: {fileID: 2097272214745190213, guid: c5b504a31fb066f41948b6bbfcb64c97, type: 3} propertyPath: m_LocalPosition.x @@ -1171,7 +1013,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 2036427477293931963, guid: 501710d4964a8c24ea184629691c1b0d, type: 3} propertyPath: m_RootOrder - value: 4 + value: 3 objectReference: {fileID: 0} - target: {fileID: 2036427477293931963, guid: 501710d4964a8c24ea184629691c1b0d, type: 3} propertyPath: m_LocalPosition.x @@ -1228,7 +1070,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 1414075886367445506, guid: 5c28c8e7487321a4fb3834fa28034d89, type: 3} propertyPath: m_RootOrder - value: 10 + value: 9 objectReference: {fileID: 0} - target: {fileID: 1414075886367445506, guid: 5c28c8e7487321a4fb3834fa28034d89, type: 3} propertyPath: m_LocalPosition.x @@ -1682,7 +1524,7 @@ PrefabInstance: m_Modifications: - target: {fileID: 918107125066696555, guid: d451fc952bc2b6848bdb7f6f5ecce4f3, type: 3} propertyPath: m_RootOrder - value: 3 + value: 2 objectReference: {fileID: 0} - target: {fileID: 918107125066696555, guid: d451fc952bc2b6848bdb7f6f5ecce4f3, type: 3} propertyPath: m_LocalPosition.x @@ -1935,26 +1777,104 @@ Transform: m_CorrespondingSourceObject: {fileID: 400000, guid: 9ada23a6ef88d194e832263f906fb0af, type: 3} m_PrefabInstance: {fileID: 390509458} m_PrefabAsset: {fileID: 0} ---- !u!1 &2017276433 stripped +--- !u!1001 &1985382084 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 1124232653639928723, guid: 5c28c8e7487321a4fb3834fa28034d89, type: 3} + propertyPath: uniqueIdentifier + value: 7c53f2cc-bf8a-4391-b4a9-71529f036c6d + objectReference: {fileID: 0} + - target: {fileID: 1414075886367445506, guid: 5c28c8e7487321a4fb3834fa28034d89, type: 3} + propertyPath: m_RootOrder + value: 10 + objectReference: {fileID: 0} + - target: {fileID: 1414075886367445506, guid: 5c28c8e7487321a4fb3834fa28034d89, type: 3} + propertyPath: m_LocalPosition.x + value: 54.64 + objectReference: {fileID: 0} + - target: {fileID: 1414075886367445506, guid: 5c28c8e7487321a4fb3834fa28034d89, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1414075886367445506, guid: 5c28c8e7487321a4fb3834fa28034d89, type: 3} + propertyPath: m_LocalPosition.z + value: 26.92 + objectReference: {fileID: 0} + - target: {fileID: 1414075886367445506, guid: 5c28c8e7487321a4fb3834fa28034d89, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1414075886367445506, guid: 5c28c8e7487321a4fb3834fa28034d89, type: 3} + propertyPath: m_LocalRotation.x + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 1414075886367445506, guid: 5c28c8e7487321a4fb3834fa28034d89, type: 3} + propertyPath: m_LocalRotation.y + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 1414075886367445506, guid: 5c28c8e7487321a4fb3834fa28034d89, type: 3} + propertyPath: m_LocalRotation.z + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 1414075886367445506, guid: 5c28c8e7487321a4fb3834fa28034d89, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1414075886367445506, guid: 5c28c8e7487321a4fb3834fa28034d89, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1414075886367445506, guid: 5c28c8e7487321a4fb3834fa28034d89, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1414075886367445510, guid: 5c28c8e7487321a4fb3834fa28034d89, type: 3} + propertyPath: m_Name + value: Enemy Swordsman + objectReference: {fileID: 0} + - target: {fileID: 4743396301467440207, guid: 5c28c8e7487321a4fb3834fa28034d89, type: 3} + propertyPath: defaultWeapon + value: + objectReference: {fileID: 11400000, guid: 844edbc579ffde4488f3983866615990, type: 2} + - target: {fileID: 5166244032097962762, guid: 5c28c8e7487321a4fb3834fa28034d89, type: 3} + propertyPath: progression + value: + objectReference: {fileID: 11400000, guid: 62a385bdc0781d5428fadf8b0ce22722, type: 2} + - target: {fileID: 5166244032097962762, guid: 5c28c8e7487321a4fb3834fa28034d89, type: 3} + propertyPath: currentLevel + value: 3 + objectReference: {fileID: 0} + - target: {fileID: 5166244032097962762, guid: 5c28c8e7487321a4fb3834fa28034d89, type: 3} + propertyPath: characterClass + value: 1 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 5c28c8e7487321a4fb3834fa28034d89, type: 3} +--- !u!1 &1985382085 stripped GameObject: - m_CorrespondingSourceObject: {fileID: 8993727228351368283, guid: 3b9be960c13452443b384e4b83e48ff8, type: 3} - m_PrefabInstance: {fileID: 581343936} + m_CorrespondingSourceObject: {fileID: 1414075886367445510, guid: 5c28c8e7487321a4fb3834fa28034d89, type: 3} + m_PrefabInstance: {fileID: 1985382084} m_PrefabAsset: {fileID: 0} ---- !u!114 &2017276447 -MonoBehaviour: +--- !u!54 &1985382086 +Rigidbody: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 2017276433} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 46bfd0b5600e6444eae7b85b8d323dbf, type: 3} - m_Name: - m_EditorClassIdentifier: - startingLevel: 1 - characterClass: 1 - progression: {fileID: 11400000, guid: 62a385bdc0781d5428fadf8b0ce22722, type: 2} + m_GameObject: {fileID: 1985382085} + serializedVersion: 2 + m_Mass: 1 + m_Drag: 0 + m_AngularDrag: 0.05 + m_UseGravity: 1 + m_IsKinematic: 0 + m_Interpolate: 0 + m_Constraints: 0 + m_CollisionDetection: 0 --- !u!4 &2111827178 stripped Transform: m_CorrespondingSourceObject: {fileID: 400000, guid: 9ada23a6ef88d194e832263f906fb0af, type: 3} From fa60aa9e6cf7ca3e3c419590222b5812a51bc131 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcel=20Ko=C5=82odziej?= Date: Sun, 2 Jul 2023 17:54:58 +0200 Subject: [PATCH 3/4] Level up Showing particles and adding health while level up --- .../GameDev.tv Assets/Self Heal.meta | 8 + .../Self Heal/Heal Material.mat | 77 + .../Self Heal/Heal Material.mat.meta | 9 + .../Self Heal/Heal Particle.png | Bin 0 -> 1051 bytes .../Self Heal/Heal Particle.png.meta | 84 + .../GameDev.tv Assets/Self Heal/SH_VFX.prefab | 3154 +++++++++++++++++ .../Self Heal/SH_VFX.prefab.meta | 9 + Assets/DestroyAfterEffect.cs | 14 +- Assets/Game/Effects/LevelUp.prefab | 134 + Assets/Game/Effects/LevelUp.prefab.meta | 7 + Assets/Game/Stats/BaseStats.cs | 44 +- Assets/Game/Stats/ExperianceDisplay.cs | 6 +- .../Stats/{Experiance.cs => Experience.cs} | 9 +- ...{Experiance.cs.meta => Experience.cs.meta} | 0 Assets/Game/Stats/Progression.cs | 3 - Assets/Scenes/Sandbox/SampleScene2.unity | 32 +- Assets/Scripts/Attribiutes/Health.cs | 41 +- Assets/Scripts/Saving/SavingSystem.cs | 5 + .../Scripts/SceneManagement/SavingWrapper.cs | 14 +- ProjectSettings/EditorSettings.asset | 2 +- 20 files changed, 3615 insertions(+), 37 deletions(-) create mode 100644 Assets/Asset Packs/GameDev.tv Assets/Self Heal.meta create mode 100644 Assets/Asset Packs/GameDev.tv Assets/Self Heal/Heal Material.mat create mode 100644 Assets/Asset Packs/GameDev.tv Assets/Self Heal/Heal Material.mat.meta create mode 100644 Assets/Asset Packs/GameDev.tv Assets/Self Heal/Heal Particle.png create mode 100644 Assets/Asset Packs/GameDev.tv Assets/Self Heal/Heal Particle.png.meta create mode 100644 Assets/Asset Packs/GameDev.tv Assets/Self Heal/SH_VFX.prefab create mode 100644 Assets/Asset Packs/GameDev.tv Assets/Self Heal/SH_VFX.prefab.meta create mode 100644 Assets/Game/Effects/LevelUp.prefab create mode 100644 Assets/Game/Effects/LevelUp.prefab.meta rename Assets/Game/Stats/{Experiance.cs => Experience.cs} (69%) rename Assets/Game/Stats/{Experiance.cs.meta => Experience.cs.meta} (100%) diff --git a/Assets/Asset Packs/GameDev.tv Assets/Self Heal.meta b/Assets/Asset Packs/GameDev.tv Assets/Self Heal.meta new file mode 100644 index 0000000..61a6498 --- /dev/null +++ b/Assets/Asset Packs/GameDev.tv Assets/Self Heal.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: d5e223f7a95a9ca4eb47d753b9243b7e +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Asset Packs/GameDev.tv Assets/Self Heal/Heal Material.mat b/Assets/Asset Packs/GameDev.tv Assets/Self Heal/Heal Material.mat new file mode 100644 index 0000000..3297ea6 --- /dev/null +++ b/Assets/Asset Packs/GameDev.tv Assets/Self Heal/Heal Material.mat @@ -0,0 +1,77 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: Heal Material + m_Shader: {fileID: 200, guid: 0000000000000000f000000000000000, type: 0} + m_ShaderKeywords: + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 2800000, guid: 5fa7347902ea5c840b59ba13871b9838, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _BumpScale: 1 + - _Cutoff: 0.5 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _GlossMapScale: 1 + - _Glossiness: 0.5 + - _GlossyReflections: 1 + - _InvFade: 1 + - _Metallic: 0 + - _Mode: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.02 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _UVSec: 0 + - _ZWrite: 1 + m_Colors: + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} + - _TintColor: {r: 0.5, g: 0.5, b: 0.5, a: 0.5} diff --git a/Assets/Asset Packs/GameDev.tv Assets/Self Heal/Heal Material.mat.meta b/Assets/Asset Packs/GameDev.tv Assets/Self Heal/Heal Material.mat.meta new file mode 100644 index 0000000..a7b8195 --- /dev/null +++ b/Assets/Asset Packs/GameDev.tv Assets/Self Heal/Heal Material.mat.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 02dbf7c7549951640bfc5b067fd62b2b +timeCreated: 1500460637 +licenseType: Free +NativeFormatImporter: + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Asset Packs/GameDev.tv Assets/Self Heal/Heal Particle.png b/Assets/Asset Packs/GameDev.tv Assets/Self Heal/Heal Particle.png new file mode 100644 index 0000000000000000000000000000000000000000..cfe80ab5b562515e2dfe397e0384aa6798af7dc8 GIT binary patch literal 1051 zcmaJ=J#5oJ6n3eEP}Q)*baJHvQscAT=EtX+D)l)usE(pEsF4s-UHh6?seQ)261Q|f zOfa%AA{e@MMW{$+WkXDesS69LV1a?DoYVXuL3omV_wK&$d+*-8ds?gB%1m9I5(FVr zS;2KaK1#n!ll=eVGiTw!LDtwT)Ig>#kX6ePHcDg{(G`02$Qp3qsf}q zDsreV*(pX!{E)K+VR0!5ZKp#R*d#44(8cdZ$0G1tU0lyuvK1Pn?XB!ZWNok7aP~Tm z=88)bGS0fR;a0+C)5JA}OcBSsTM57i|G);rD z3RN}B5!rY*V0MxX;+cU0Cb1KFA@gVeQbl`{?l4{CnVuiP4~Mcr+%FR^7)lsEjPm`baNO7p39OTt?nDm1xUHEqREUg-*o;OEO1B49thFhlahry~ zFw&|O!1Z-6aA`Nb(c@Sassu5!1BXOieeU)@q8Jpri!s) zYNnhUa4~gud=jt$*Bx=yvD~yB{E$b+B=Q~*w;WL)^p1_ZvAHal$LjUD?)Y5fv0TWL zf$8P`aoK|<-a+Yf*t*;qHa`h?$49)ikNvNQ{8?PAtv1ZFp5591xy@HDuzGdvO!)Fz zzRkT(1(zDh=hIKGGJ-rkS!$gf9F-297f)W?MW?H8IN~k*Ho=F#Y=7co`k+U)k$JZ? i@().IsAlive()){ - Destroy(gameObject); + if(!GetComponent().IsAlive()) + { + if (targetToDestroy != null) + { + Destroy(targetToDestroy); + } + else + { + Destroy(gameObject); + } } } } - } diff --git a/Assets/Game/Effects/LevelUp.prefab b/Assets/Game/Effects/LevelUp.prefab new file mode 100644 index 0000000..6dcdb26 --- /dev/null +++ b/Assets/Game/Effects/LevelUp.prefab @@ -0,0 +1,134 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &7481326330481150739 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 3780808664529361485} + m_Layer: 0 + m_Name: LevelUp + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &3780808664529361485 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7481326330481150739} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 6576749595427130353} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1001 &6580997710919368805 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 3780808664529361485} + m_Modifications: + - target: {fileID: 1770094935522392, guid: 7098bdbdcde165049872f566c6a00e5f, type: 3} + propertyPath: m_Name + value: SH_VFX + objectReference: {fileID: 0} + - target: {fileID: 4829491530746772, guid: 7098bdbdcde165049872f566c6a00e5f, type: 3} + propertyPath: m_RootOrder + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4829491530746772, guid: 7098bdbdcde165049872f566c6a00e5f, type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4829491530746772, guid: 7098bdbdcde165049872f566c6a00e5f, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4829491530746772, guid: 7098bdbdcde165049872f566c6a00e5f, type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4829491530746772, guid: 7098bdbdcde165049872f566c6a00e5f, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 4829491530746772, guid: 7098bdbdcde165049872f566c6a00e5f, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4829491530746772, guid: 7098bdbdcde165049872f566c6a00e5f, type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4829491530746772, guid: 7098bdbdcde165049872f566c6a00e5f, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4829491530746772, guid: 7098bdbdcde165049872f566c6a00e5f, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4829491530746772, guid: 7098bdbdcde165049872f566c6a00e5f, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4829491530746772, guid: 7098bdbdcde165049872f566c6a00e5f, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 198969377575857584, guid: 7098bdbdcde165049872f566c6a00e5f, type: 3} + propertyPath: moveWithTransform + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 198969377575857584, guid: 7098bdbdcde165049872f566c6a00e5f, type: 3} + propertyPath: InitialModule.startColor.maxColor.b + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 198969377575857584, guid: 7098bdbdcde165049872f566c6a00e5f, type: 3} + propertyPath: InitialModule.startColor.maxColor.g + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 198969377575857584, guid: 7098bdbdcde165049872f566c6a00e5f, type: 3} + propertyPath: InitialModule.startColor.maxColor.r + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 199840379123832142, guid: 7098bdbdcde165049872f566c6a00e5f, type: 3} + propertyPath: m_Materials.Array.size + value: 1 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 7098bdbdcde165049872f566c6a00e5f, type: 3} +--- !u!4 &6576749595427130353 stripped +Transform: + m_CorrespondingSourceObject: {fileID: 4829491530746772, guid: 7098bdbdcde165049872f566c6a00e5f, type: 3} + m_PrefabInstance: {fileID: 6580997710919368805} + m_PrefabAsset: {fileID: 0} +--- !u!1 &6580374132433337405 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 1770094935522392, guid: 7098bdbdcde165049872f566c6a00e5f, type: 3} + m_PrefabInstance: {fileID: 6580997710919368805} + m_PrefabAsset: {fileID: 0} +--- !u!114 &6935215024541640914 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6580374132433337405} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 2550901dd63b5d548ab251ae6dc085f3, type: 3} + m_Name: + m_EditorClassIdentifier: + targetToDestroy: {fileID: 7481326330481150739} diff --git a/Assets/Game/Effects/LevelUp.prefab.meta b/Assets/Game/Effects/LevelUp.prefab.meta new file mode 100644 index 0000000..80b6513 --- /dev/null +++ b/Assets/Game/Effects/LevelUp.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 3dd30e02b92325b48b18d08f7e342006 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Game/Stats/BaseStats.cs b/Assets/Game/Stats/BaseStats.cs index 475270c..d2cb7d4 100644 --- a/Assets/Game/Stats/BaseStats.cs +++ b/Assets/Game/Stats/BaseStats.cs @@ -2,6 +2,7 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; +using static UnityEngine.ParticleSystem; namespace RPG.Stats { @@ -11,24 +12,57 @@ public class BaseStats : MonoBehaviour [SerializeField] int startingLevel = 1; [SerializeField] CharacterClass characterClass; [SerializeField] Progression progression = null; + int currentLevel = 0; + public event Action onLevelUp; - private void Update() { - if (gameObject.tag == "Player") + + [SerializeField] private GameObject levelup_Particle; + + private void Start() + { + currentLevel = CalculateLevel(); + Experience experiance = GetComponent(); + if (experiance != null) { - print(GetLevel()); + experiance.onExperianceGained += UpdateLevel; } + + } + private void PlayParticle() + { + Instantiate(levelup_Particle, transform); + } + private void UpdateLevel() + { + int newLevel = CalculateLevel(); + if (newLevel > currentLevel) + { + currentLevel = newLevel; + print("Levelling up!"); + PlayParticle(); + } } public float GetStat(Stat stat) { return progression.GetStat(stat, characterClass, GetLevel()); } + public int GetLevel() + { + if (currentLevel < 1) + { + currentLevel = CalculateLevel(); + } + + return currentLevel; + } + public int CalculateLevel() { - Experiance experiance = GetComponent(); + Experience experiance = GetComponent(); if (experiance == null) return startingLevel; - float currentXP = GetComponent().GetPoints(); + float currentXP = GetComponent().GetPoints(); int penultimateLevel = progression.GetLevels(Stat.ExperianceToLevelUp, characterClass); for (int level = 1; level <= penultimateLevel; level++) diff --git a/Assets/Game/Stats/ExperianceDisplay.cs b/Assets/Game/Stats/ExperianceDisplay.cs index 7a9bf8b..77d88f5 100644 --- a/Assets/Game/Stats/ExperianceDisplay.cs +++ b/Assets/Game/Stats/ExperianceDisplay.cs @@ -10,15 +10,15 @@ namespace RPG.Stats public class ExperianceDisplay : MonoBehaviour { - Experiance experiance; + Experience experience; private void Awake() { - experiance = GameObject.FindWithTag("Player").GetComponent(); + experience = GameObject.FindWithTag("Player").GetComponent(); } private void Update() { - GetComponent().text = String.Format("{0:0}", experiance.GetPoints()); + GetComponent().text = String.Format("{0:0}", experience.GetPoints()); } } } diff --git a/Assets/Game/Stats/Experiance.cs b/Assets/Game/Stats/Experience.cs similarity index 69% rename from Assets/Game/Stats/Experiance.cs rename to Assets/Game/Stats/Experience.cs index fdfd636..f89bf58 100644 --- a/Assets/Game/Stats/Experiance.cs +++ b/Assets/Game/Stats/Experience.cs @@ -7,13 +7,16 @@ namespace RPG.Stats { - public class Experiance : MonoBehaviour, ISaveable + public class Experience : MonoBehaviour, ISaveable { [SerializeField] float experiancePoints = 0; - public void GainExperianceReward(float experiance) + public event Action onExperianceGained; + + public void GainExperianceReward(float experience) { - experiancePoints += experiance; + experiancePoints += experience; + onExperianceGained(); } public object CaptureState() { diff --git a/Assets/Game/Stats/Experiance.cs.meta b/Assets/Game/Stats/Experience.cs.meta similarity index 100% rename from Assets/Game/Stats/Experiance.cs.meta rename to Assets/Game/Stats/Experience.cs.meta diff --git a/Assets/Game/Stats/Progression.cs b/Assets/Game/Stats/Progression.cs index 0ba5a55..5feea2c 100644 --- a/Assets/Game/Stats/Progression.cs +++ b/Assets/Game/Stats/Progression.cs @@ -42,15 +42,12 @@ public float GetStat(Stat stat, CharacterClass characterClass, int level) #endregion } - - public int GetLevels(Stat stat, CharacterClass characterClass) { BuildLookup(); float[] levels = lookupTable[characterClass][stat]; return levels.Length; - } private void BuildLookup() diff --git a/Assets/Scenes/Sandbox/SampleScene2.unity b/Assets/Scenes/Sandbox/SampleScene2.unity index 1fde375..c2eb666 100644 --- a/Assets/Scenes/Sandbox/SampleScene2.unity +++ b/Assets/Scenes/Sandbox/SampleScene2.unity @@ -904,6 +904,23 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: c9f0b606b135dec4b9d53a72428090d6, type: 3} m_Name: m_EditorClassIdentifier: +--- !u!1 &781973906 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 8932835182937148713, guid: c1f5a3649aa42f2488c5fb745bdd5a1b, type: 3} + m_PrefabInstance: {fileID: 1622950679} + m_PrefabAsset: {fileID: 0} +--- !u!114 &781973911 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 781973906} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: a66d0aec2fa49fb4193005b67a3d0291, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!1 &956729038 GameObject: m_ObjectHideFlags: 0 @@ -1074,7 +1091,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 1414075886367445506, guid: 5c28c8e7487321a4fb3834fa28034d89, type: 3} propertyPath: m_LocalPosition.x - value: 66.26 + value: 63.01 objectReference: {fileID: 0} - target: {fileID: 1414075886367445506, guid: 5c28c8e7487321a4fb3834fa28034d89, type: 3} propertyPath: m_LocalPosition.y @@ -1082,7 +1099,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 1414075886367445506, guid: 5c28c8e7487321a4fb3834fa28034d89, type: 3} propertyPath: m_LocalPosition.z - value: 25.48 + value: 18.63 objectReference: {fileID: 0} - target: {fileID: 1414075886367445506, guid: 5c28c8e7487321a4fb3834fa28034d89, type: 3} propertyPath: m_LocalRotation.w @@ -1383,6 +1400,10 @@ PrefabInstance: propertyPath: currentLevel value: 1 objectReference: {fileID: 0} + - target: {fileID: 2416820501513256478, guid: c1f5a3649aa42f2488c5fb745bdd5a1b, type: 3} + propertyPath: levelup_Particle + value: + objectReference: {fileID: 7481326330481150739, guid: 3dd30e02b92325b48b18d08f7e342006, type: 3} - target: {fileID: 2764833630395926868, guid: c1f5a3649aa42f2488c5fb745bdd5a1b, type: 3} propertyPath: m_RootOrder value: 0 @@ -1439,7 +1460,12 @@ PrefabInstance: propertyPath: m_AnchoredPosition.x value: 66.9375 objectReference: {fileID: 0} - m_RemovedComponents: [] + - target: {fileID: 5612484952537521235, guid: c1f5a3649aa42f2488c5fb745bdd5a1b, type: 3} + propertyPath: defaultWeapon + value: + objectReference: {fileID: 11400000, guid: 844edbc579ffde4488f3983866615990, type: 2} + m_RemovedComponents: + - {fileID: 685475197870253786, guid: c1f5a3649aa42f2488c5fb745bdd5a1b, type: 3} m_SourcePrefab: {fileID: 100100000, guid: c1f5a3649aa42f2488c5fb745bdd5a1b, type: 3} --- !u!4 &1634880757 stripped Transform: diff --git a/Assets/Scripts/Attribiutes/Health.cs b/Assets/Scripts/Attribiutes/Health.cs index 440e919..e31e7dc 100644 --- a/Assets/Scripts/Attribiutes/Health.cs +++ b/Assets/Scripts/Attribiutes/Health.cs @@ -11,12 +11,19 @@ namespace RPG.Attribiutes { public class Health : MonoBehaviour, ISaveable { - [SerializeField] float healthPoints = 100f; + [SerializeField] float regenerationPercentage = 70; + float healthPoints = -1f; Animator _animator; private const string Dead = "dead"; public bool isDead = false; - private void Start() { - healthPoints = GetComponent().GetStat(Stat.Health); + + private void Start() + { + GetComponent().onLevelUp += RegenerateHealth; + if (healthPoints < 0) + { + healthPoints = GetComponent().GetStat(Stat.Health); + } } public void TakeDamage(GameObject instigator, float damage) { healthPoints = MathF.Max(healthPoints - damage, 0); @@ -25,32 +32,36 @@ public void TakeDamage(GameObject instigator, float damage) { AwardExperiance(instigator); } } - + private void RegenerateHealth() + { + float regenHealthPoints = GetComponent().GetStat(Stat.Health) * (regenerationPercentage / 100); + healthPoints = MathF.Max(healthPoints, regenerationPercentage); + } private void AwardExperiance(GameObject instigator) { - Experiance experiance = instigator.GetComponent(); + Experience experiance = instigator.GetComponent(); if (experiance == null) return; experiance.GainExperianceReward(GetComponent().GetStat(Stat.ExpieranceReward)); } - public float GetPercentage() { return 100 * (healthPoints / GetComponent().GetStat(Stat.Health)); } - public bool IsDead() { + public bool IsDead() + { return isDead; } + public void Death() + { + if (isDead) return; - public void Death() { - if (isDead) return; - - Debug.Log("Death come uppon you.."); - isDead = true; - GetComponent().SetTrigger(Dead); - GetComponent().CancelCurrentAction(); - } + Debug.Log("Death come uppon you.."); + isDead = true; + GetComponent().SetTrigger(Dead); + GetComponent().CancelCurrentAction(); + } public object CaptureState() { return healthPoints; diff --git a/Assets/Scripts/Saving/SavingSystem.cs b/Assets/Scripts/Saving/SavingSystem.cs index c510b42..ec72f5b 100644 --- a/Assets/Scripts/Saving/SavingSystem.cs +++ b/Assets/Scripts/Saving/SavingSystem.cs @@ -91,5 +91,10 @@ private string GetPathFromSaveFile(string saveFile) { return Path.Combine(Application.persistentDataPath, saveFile + ".sav"); } + + public void DeleteSaveFile(string saveFile) + { + File.Delete(GetPathFromSaveFile(saveFile)); + } } } \ No newline at end of file diff --git a/Assets/Scripts/SceneManagement/SavingWrapper.cs b/Assets/Scripts/SceneManagement/SavingWrapper.cs index ddf0220..8260235 100644 --- a/Assets/Scripts/SceneManagement/SavingWrapper.cs +++ b/Assets/Scripts/SceneManagement/SavingWrapper.cs @@ -10,7 +10,10 @@ public class SavingWrapper : MonoBehaviour [SerializeField] float fadeInTime = 0.2f; - private IEnumerator Start() { + private void Awake() { + StartCoroutine(LoadLastScene()); + } + private IEnumerator LoadLastScene() { Fader fader = FindObjectOfType(); print(fader); @@ -28,6 +31,10 @@ private void Update() { { Load(); } + if (Input.GetKeyDown(KeyCode.Q)) + { + Delete(); + } } public void Load() @@ -39,5 +46,10 @@ public void Save() { GetComponent().Save(defaultSaveFile); } + + public void Delete() + { + GetComponent().Delete(defaultSaveFile); + } } } \ No newline at end of file diff --git a/ProjectSettings/EditorSettings.asset b/ProjectSettings/EditorSettings.asset index a531755..ae84e93 100644 --- a/ProjectSettings/EditorSettings.asset +++ b/ProjectSettings/EditorSettings.asset @@ -24,7 +24,7 @@ EditorSettings: m_CachingShaderPreprocessor: 1 m_PrefabModeAllowAutoSave: 1 m_EnterPlayModeOptionsEnabled: 1 - m_EnterPlayModeOptions: 2 + m_EnterPlayModeOptions: 3 m_GameObjectNamingDigits: 1 m_GameObjectNamingScheme: 0 m_AssetNamingUsesSpace: 1 From c4738657f74db741313d79394d078d9ce34ff7fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcel=20Ko=C5=82odziej?= Date: Wed, 12 Jul 2023 16:49:16 +0200 Subject: [PATCH 4/4] Damage progression with levels Base weapon damage is now coustomable with Progression SO --- .vscode/settings.json | 5 +- .vsconfig | 6 + Assets/Game/Stats/BaseStats.cs | 4 +- Assets/Game/Stats/Stats.cs | 1 + Assets/Game/Weapons/Resources/Sword.asset | 4 +- Assets/Game/Weapons/Weapons.cs | 4 +- Assets/Scenes/Sandbox/SampleScene2.unity | 196 ++++++++++---------- Assets/Scripts/Attribiutes/Health.cs | 11 ++ Assets/Scripts/Attribiutes/HealthDisplay.cs | 2 +- Assets/Scripts/Combat/Fighter.cs | 12 +- Assets/Scripts/Combat/HealthDisplayEnemy.cs | 2 +- Assets/Scripts/Control/AIController.cs | 2 +- Assets/Scripts/Core/Progression.asset | 14 +- Assets/Scripts/Player/Mover.cs | 19 +- 14 files changed, 160 insertions(+), 122 deletions(-) create mode 100644 .vsconfig diff --git a/.vscode/settings.json b/.vscode/settings.json index e232cd6..4941b84 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,4 +1,4 @@ -{ +{ "files.exclude": { "**/.DS_Store":true, @@ -51,5 +51,6 @@ "ProjectSettings/":true, "temp/":true, "Temp/":true - } + }, + "dotnet.defaultSolution": "RpgSystem.sln" } \ No newline at end of file diff --git a/.vsconfig b/.vsconfig new file mode 100644 index 0000000..d70cd98 --- /dev/null +++ b/.vsconfig @@ -0,0 +1,6 @@ +{ + "version": "1.0", + "components": [ + "Microsoft.VisualStudio.Workload.ManagedGame" + ] +} diff --git a/Assets/Game/Stats/BaseStats.cs b/Assets/Game/Stats/BaseStats.cs index d2cb7d4..5fd9d1a 100644 --- a/Assets/Game/Stats/BaseStats.cs +++ b/Assets/Game/Stats/BaseStats.cs @@ -14,8 +14,6 @@ public class BaseStats : MonoBehaviour [SerializeField] Progression progression = null; int currentLevel = 0; public event Action onLevelUp; - - [SerializeField] private GameObject levelup_Particle; private void Start() @@ -26,7 +24,6 @@ private void Start() { experiance.onExperianceGained += UpdateLevel; } - } private void PlayParticle() { @@ -40,6 +37,7 @@ private void UpdateLevel() currentLevel = newLevel; print("Levelling up!"); PlayParticle(); + onLevelUp(); } } diff --git a/Assets/Game/Stats/Stats.cs b/Assets/Game/Stats/Stats.cs index d11ab63..a4aa81c 100644 --- a/Assets/Game/Stats/Stats.cs +++ b/Assets/Game/Stats/Stats.cs @@ -10,5 +10,6 @@ public enum Stat Health, ExpieranceReward, ExperianceToLevelUp, + WeaponDamage, } } \ No newline at end of file diff --git a/Assets/Game/Weapons/Resources/Sword.asset b/Assets/Game/Weapons/Resources/Sword.asset index 7c63b17..a885268 100644 --- a/Assets/Game/Weapons/Resources/Sword.asset +++ b/Assets/Game/Weapons/Resources/Sword.asset @@ -15,6 +15,6 @@ MonoBehaviour: animatorOverride: {fileID: 22100000, guid: 51afcf0b6656349409f7076aa44bb544, type: 2} equpipedPrefab: {fileID: 6676521290224804715, guid: 6ede0ff8790d57242917414e790eeeb3, type: 3} weaponRange: 3 - weaponDamage: 30 - isRightHanded: 1 + weaponDamage: 150 + isRightHanded: 0 projectile: {fileID: 0} diff --git a/Assets/Game/Weapons/Weapons.cs b/Assets/Game/Weapons/Weapons.cs index 3eb84a1..9526de1 100644 --- a/Assets/Game/Weapons/Weapons.cs +++ b/Assets/Game/Weapons/Weapons.cs @@ -18,9 +18,7 @@ public class Weapons : ScriptableObject const string weaponName = "Weapon"; public void Spawn(Transform rightHand, Transform leftHand, Animator animator) { - DestroyOldWeapon(rightHand, leftHand); - if (equpipedPrefab != null) { @@ -70,7 +68,7 @@ private Transform GetTransform(Transform rightHand, Transform leftHand) return projectile != null; } - public void LunchProjectile(Transform rightHand, Transform leftHand, Health target, GameObject instigator) + public void LunchProjectile(Transform rightHand, Transform leftHand, Health target, GameObject instigator, float calculatedDamage) { ArrowProjectile projectileInstance = Instantiate(projectile, GetTransform(rightHand, leftHand).position, Quaternion.identity); projectileInstance.SetTarget(target, instigator, weaponDamage); diff --git a/Assets/Scenes/Sandbox/SampleScene2.unity b/Assets/Scenes/Sandbox/SampleScene2.unity index c2eb666..eee3b12 100644 --- a/Assets/Scenes/Sandbox/SampleScene2.unity +++ b/Assets/Scenes/Sandbox/SampleScene2.unity @@ -718,6 +718,22 @@ PrefabInstance: m_RemovedComponents: - {fileID: 7128389277541425086, guid: 6ede0ff8790d57242917414e790eeeb3, type: 3} m_SourcePrefab: {fileID: 100100000, guid: 6ede0ff8790d57242917414e790eeeb3, type: 3} +--- !u!114 &523659214 stripped +MonoBehaviour: + m_CorrespondingSourceObject: {fileID: 2036427477293931962, guid: 501710d4964a8c24ea184629691c1b0d, type: 3} + m_PrefabInstance: {fileID: 1113952414} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5069a61300399224e85d95406e1811a6, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!4 &523659215 stripped +Transform: + m_CorrespondingSourceObject: {fileID: 2036427477293931963, guid: 501710d4964a8c24ea184629691c1b0d, type: 3} + m_PrefabInstance: {fileID: 1113952414} + m_PrefabAsset: {fileID: 0} --- !u!1001 &524364810 PrefabInstance: m_ObjectHideFlags: 0 @@ -725,13 +741,17 @@ PrefabInstance: m_Modification: m_TransformParent: {fileID: 0} m_Modifications: + - target: {fileID: 627961579878131576, guid: 5c28c8e7487321a4fb3834fa28034d89, type: 3} + propertyPath: patrolPath + value: + objectReference: {fileID: 523659214} - target: {fileID: 1414075886367445506, guid: 5c28c8e7487321a4fb3834fa28034d89, type: 3} propertyPath: m_RootOrder value: 1 objectReference: {fileID: 0} - target: {fileID: 1414075886367445506, guid: 5c28c8e7487321a4fb3834fa28034d89, type: 3} propertyPath: m_LocalPosition.x - value: 60.32 + value: 56.84 objectReference: {fileID: 0} - target: {fileID: 1414075886367445506, guid: 5c28c8e7487321a4fb3834fa28034d89, type: 3} propertyPath: m_LocalPosition.y @@ -739,7 +759,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 1414075886367445506, guid: 5c28c8e7487321a4fb3834fa28034d89, type: 3} propertyPath: m_LocalPosition.z - value: 25.48 + value: 20.03 objectReference: {fileID: 0} - target: {fileID: 1414075886367445506, guid: 5c28c8e7487321a4fb3834fa28034d89, type: 3} propertyPath: m_LocalRotation.w @@ -1034,7 +1054,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 2036427477293931963, guid: 501710d4964a8c24ea184629691c1b0d, type: 3} propertyPath: m_LocalPosition.x - value: 51.08 + value: 55.89 objectReference: {fileID: 0} - target: {fileID: 2036427477293931963, guid: 501710d4964a8c24ea184629691c1b0d, type: 3} propertyPath: m_LocalPosition.y @@ -1042,7 +1062,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 2036427477293931963, guid: 501710d4964a8c24ea184629691c1b0d, type: 3} propertyPath: m_LocalPosition.z - value: 44.77 + value: 21.81 objectReference: {fileID: 0} - target: {fileID: 2036427477293931963, guid: 501710d4964a8c24ea184629691c1b0d, type: 3} propertyPath: m_LocalRotation.w @@ -1072,102 +1092,16 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} - m_RemovedComponents: [] - m_SourcePrefab: {fileID: 100100000, guid: 501710d4964a8c24ea184629691c1b0d, type: 3} ---- !u!1001 &1324447001 -PrefabInstance: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - m_TransformParent: {fileID: 0} - m_Modifications: - - target: {fileID: 1124232653639928723, guid: 5c28c8e7487321a4fb3834fa28034d89, type: 3} - propertyPath: uniqueIdentifier - value: 2e7c65bc-4b1f-4165-8fe1-9c5de1060542 - objectReference: {fileID: 0} - - target: {fileID: 1414075886367445506, guid: 5c28c8e7487321a4fb3834fa28034d89, type: 3} - propertyPath: m_RootOrder - value: 9 - objectReference: {fileID: 0} - - target: {fileID: 1414075886367445506, guid: 5c28c8e7487321a4fb3834fa28034d89, type: 3} + - target: {fileID: 2036427477845918037, guid: 501710d4964a8c24ea184629691c1b0d, type: 3} propertyPath: m_LocalPosition.x - value: 63.01 + value: 6.32 objectReference: {fileID: 0} - - target: {fileID: 1414075886367445506, guid: 5c28c8e7487321a4fb3834fa28034d89, type: 3} - propertyPath: m_LocalPosition.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1414075886367445506, guid: 5c28c8e7487321a4fb3834fa28034d89, type: 3} + - target: {fileID: 2036427477845918037, guid: 501710d4964a8c24ea184629691c1b0d, type: 3} propertyPath: m_LocalPosition.z - value: 18.63 - objectReference: {fileID: 0} - - target: {fileID: 1414075886367445506, guid: 5c28c8e7487321a4fb3834fa28034d89, type: 3} - propertyPath: m_LocalRotation.w - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 1414075886367445506, guid: 5c28c8e7487321a4fb3834fa28034d89, type: 3} - propertyPath: m_LocalRotation.x - value: -0 - objectReference: {fileID: 0} - - target: {fileID: 1414075886367445506, guid: 5c28c8e7487321a4fb3834fa28034d89, type: 3} - propertyPath: m_LocalRotation.y - value: -0 - objectReference: {fileID: 0} - - target: {fileID: 1414075886367445506, guid: 5c28c8e7487321a4fb3834fa28034d89, type: 3} - propertyPath: m_LocalRotation.z - value: -0 - objectReference: {fileID: 0} - - target: {fileID: 1414075886367445506, guid: 5c28c8e7487321a4fb3834fa28034d89, type: 3} - propertyPath: m_LocalEulerAnglesHint.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1414075886367445506, guid: 5c28c8e7487321a4fb3834fa28034d89, type: 3} - propertyPath: m_LocalEulerAnglesHint.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1414075886367445506, guid: 5c28c8e7487321a4fb3834fa28034d89, type: 3} - propertyPath: m_LocalEulerAnglesHint.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1414075886367445510, guid: 5c28c8e7487321a4fb3834fa28034d89, type: 3} - propertyPath: m_Name - value: Enemy Archer (1) - objectReference: {fileID: 0} - - target: {fileID: 5166244032097962762, guid: 5c28c8e7487321a4fb3834fa28034d89, type: 3} - propertyPath: progression - value: - objectReference: {fileID: 11400000, guid: 62a385bdc0781d5428fadf8b0ce22722, type: 2} - - target: {fileID: 5166244032097962762, guid: 5c28c8e7487321a4fb3834fa28034d89, type: 3} - propertyPath: currentLevel - value: 3 - objectReference: {fileID: 0} - - target: {fileID: 5166244032097962762, guid: 5c28c8e7487321a4fb3834fa28034d89, type: 3} - propertyPath: characterClass - value: 2 + value: 18.41 objectReference: {fileID: 0} m_RemovedComponents: [] - m_SourcePrefab: {fileID: 100100000, guid: 5c28c8e7487321a4fb3834fa28034d89, type: 3} ---- !u!1 &1324447002 stripped -GameObject: - m_CorrespondingSourceObject: {fileID: 1414075886367445510, guid: 5c28c8e7487321a4fb3834fa28034d89, type: 3} - m_PrefabInstance: {fileID: 1324447001} - m_PrefabAsset: {fileID: 0} ---- !u!54 &1324447003 -Rigidbody: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1324447002} - serializedVersion: 2 - m_Mass: 1 - m_Drag: 0 - m_AngularDrag: 0.05 - m_UseGravity: 1 - m_IsKinematic: 0 - m_Interpolate: 0 - m_Constraints: 0 - m_CollisionDetection: 0 + m_SourcePrefab: {fileID: 100100000, guid: 501710d4964a8c24ea184629691c1b0d, type: 3} --- !u!1001 &1330690999 PrefabInstance: m_ObjectHideFlags: 0 @@ -1380,11 +1314,73 @@ PrefabInstance: objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: d451fc952bc2b6848bdb7f6f5ecce4f3, type: 3} +--- !u!1 &1468341527 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1468341528} + m_Layer: 0 + m_Name: Waypoint (4) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1468341528 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1468341527} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -1.57, y: 0, z: -8.94} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 523659215} + m_RootOrder: 4 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!4 &1504675274 stripped Transform: m_CorrespondingSourceObject: {fileID: 400000, guid: 9ada23a6ef88d194e832263f906fb0af, type: 3} m_PrefabInstance: {fileID: 146274374} m_PrefabAsset: {fileID: 0} +--- !u!1 &1516610302 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1516610303} + m_Layer: 0 + m_Name: Waypoint (5) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1516610303 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1516610302} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -2.05, y: 0, z: -3.09} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 523659215} + m_RootOrder: 5 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1001 &1622950679 PrefabInstance: m_ObjectHideFlags: 0 @@ -1460,6 +1456,10 @@ PrefabInstance: propertyPath: m_AnchoredPosition.x value: 66.9375 objectReference: {fileID: 0} + - target: {fileID: 5612484952537521232, guid: c1f5a3649aa42f2488c5fb745bdd5a1b, type: 3} + propertyPath: regenerationPercentage + value: 86.55 + objectReference: {fileID: 0} - target: {fileID: 5612484952537521235, guid: c1f5a3649aa42f2488c5fb745bdd5a1b, type: 3} propertyPath: defaultWeapon value: @@ -1816,11 +1816,11 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 1414075886367445506, guid: 5c28c8e7487321a4fb3834fa28034d89, type: 3} propertyPath: m_RootOrder - value: 10 + value: 9 objectReference: {fileID: 0} - target: {fileID: 1414075886367445506, guid: 5c28c8e7487321a4fb3834fa28034d89, type: 3} propertyPath: m_LocalPosition.x - value: 54.64 + value: 63.14 objectReference: {fileID: 0} - target: {fileID: 1414075886367445506, guid: 5c28c8e7487321a4fb3834fa28034d89, type: 3} propertyPath: m_LocalPosition.y @@ -1828,7 +1828,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 1414075886367445506, guid: 5c28c8e7487321a4fb3834fa28034d89, type: 3} propertyPath: m_LocalPosition.z - value: 26.92 + value: 22.05 objectReference: {fileID: 0} - target: {fileID: 1414075886367445506, guid: 5c28c8e7487321a4fb3834fa28034d89, type: 3} propertyPath: m_LocalRotation.w diff --git a/Assets/Scripts/Attribiutes/Health.cs b/Assets/Scripts/Attribiutes/Health.cs index e31e7dc..bbff994 100644 --- a/Assets/Scripts/Attribiutes/Health.cs +++ b/Assets/Scripts/Attribiutes/Health.cs @@ -26,12 +26,23 @@ private void Start() } } public void TakeDamage(GameObject instigator, float damage) { + print(gameObject.name + " took damage " + damage); healthPoints = MathF.Max(healthPoints - damage, 0); if (healthPoints == 0) { Death(); AwardExperiance(instigator); } } + + public float GetHealthPoints() + { + return healthPoints; + } + + public float GetMaxHealthPoints() + { + return GetComponent().GetStat(Stat.Health); + } private void RegenerateHealth() { float regenHealthPoints = GetComponent().GetStat(Stat.Health) * (regenerationPercentage / 100); diff --git a/Assets/Scripts/Attribiutes/HealthDisplay.cs b/Assets/Scripts/Attribiutes/HealthDisplay.cs index e11c900..8a38605 100644 --- a/Assets/Scripts/Attribiutes/HealthDisplay.cs +++ b/Assets/Scripts/Attribiutes/HealthDisplay.cs @@ -15,7 +15,7 @@ private void Awake() { private void Update() { - GetComponent().text = String.Format("{0:0}%", health.GetPercentage()); + GetComponent().text = String.Format("{0:0} / {1:0}", health.GetHealthPoints(), health.GetMaxHealthPoints()); } } } diff --git a/Assets/Scripts/Combat/Fighter.cs b/Assets/Scripts/Combat/Fighter.cs index 49562b8..1dbeddd 100644 --- a/Assets/Scripts/Combat/Fighter.cs +++ b/Assets/Scripts/Combat/Fighter.cs @@ -3,6 +3,8 @@ using RPG.Core; using RPG.Saving; using RPG.Attribiutes; +using RPG.Stats; +using Unity.VisualScripting; namespace RPG.Combat { public class Fighter : MonoBehaviour, IAction, ISaveable { @@ -66,15 +68,17 @@ private void TriggerAttack() void Hit() { if(target == null) { return; } - // check if weapon has a projectile - if(currentWeapon.HasProjectile()) + // check if weapon has a projectile + + float damage = GetComponent().GetStat(Stat.WeaponDamage); + if (currentWeapon.HasProjectile()) { // lunch it - currentWeapon.LunchProjectile(leftHandTransform, rightHandTransform, target, gameObject); + currentWeapon.LunchProjectile(leftHandTransform, rightHandTransform, target, gameObject, damage); // print("animation event"); } else { - target.TakeDamage(gameObject, currentWeapon.GetWeaponDamage()); + target.TakeDamage(gameObject, damage); } } diff --git a/Assets/Scripts/Combat/HealthDisplayEnemy.cs b/Assets/Scripts/Combat/HealthDisplayEnemy.cs index f726043..b42620a 100644 --- a/Assets/Scripts/Combat/HealthDisplayEnemy.cs +++ b/Assets/Scripts/Combat/HealthDisplayEnemy.cs @@ -22,7 +22,7 @@ private void Update() return; } Health health = fighter.GetTarget(); - GetComponent().text = String.Format("{0:0}%", health.GetPercentage()); + GetComponent().text = String.Format("{0:0} / {1:0}", health.GetHealthPoints(), health.GetMaxHealthPoints()); } } diff --git a/Assets/Scripts/Control/AIController.cs b/Assets/Scripts/Control/AIController.cs index 3e08dee..c3fe5e5 100644 --- a/Assets/Scripts/Control/AIController.cs +++ b/Assets/Scripts/Control/AIController.cs @@ -59,7 +59,7 @@ void Update() { private void AttackBehaviour() { fighter.Attack(player); -// Debug.Log("Attacking player"); + // Debug.Log("Attacking player"); // mover.Running(); } diff --git a/Assets/Scripts/Core/Progression.asset b/Assets/Scripts/Core/Progression.asset index 676dd5a..a4109c4 100644 --- a/Assets/Scripts/Core/Progression.asset +++ b/Assets/Scripts/Core/Progression.asset @@ -22,6 +22,10 @@ MonoBehaviour: - 200 - 400 - 800 + - 800 + - 800 + - 800 + - 800 - stat: 2 levels: - 10 @@ -30,11 +34,19 @@ MonoBehaviour: - 40 - 50 - 80 + - stat: 3 + levels: + - 50 + - 100 + - 150 + - 200 + - 250 + - 300 - characterClass: 1 stats: - stat: 0 levels: - - 50 + - 300 - 100 - 200 - 400 diff --git a/Assets/Scripts/Player/Mover.cs b/Assets/Scripts/Player/Mover.cs index 8e017bd..85f5373 100644 --- a/Assets/Scripts/Player/Mover.cs +++ b/Assets/Scripts/Player/Mover.cs @@ -15,34 +15,41 @@ public class Mover : MonoBehaviour, IAction, ISaveable { NavMeshAgent navMeshAgent; Animator _animator; Health health; - private void Start() { + + private void Start() + { navMeshAgent = GetComponent(); _animator = GetComponent(); health = GetComponent(); } - private void Update() { + private void Update() + { navMeshAgent.enabled = !health.IsDead(); UpdateAnimator(); } - public void StartMoveAction(Vector3 destination, float speedFraction) { + public void StartMoveAction(Vector3 destination, float speedFraction) + { // When we start Move we cancel fighting GetComponent().StartAction(this); MoveTo(destination, speedFraction); } - public void MoveTo(Vector3 destination, float speedFraction) { + public void MoveTo(Vector3 destination, float speedFraction) + { navMeshAgent.destination = destination; navMeshAgent.speed = maxSpeed * Mathf.Clamp01(speedFraction); navMeshAgent.isStopped = false; } - public void Cancel() { + public void Cancel() + { navMeshAgent.isStopped = true; } - private void UpdateAnimator() { + private void UpdateAnimator() + { Vector3 velocity = navMeshAgent.velocity; Vector3 localVelocity = transform.InverseTransformDirection(velocity); float speed = localVelocity.z;