From 5a48a23de1b36e1b87443c032ac5d57f90031ff9 Mon Sep 17 00:00:00 2001 From: Pedro Gomes Date: Sun, 21 Jul 2024 11:05:48 +0100 Subject: [PATCH] Cooldown for players & bugfixing - ability cooldown tracker implemented on players. - added cooldowns to multiple player spells. - added cooldown tracking on Ability bind instances, allowing players to see their spell icon on cooldown, filling out. - fixed melee slash hit vfx, no longer spawning on non-targettable units. - fixed area of effect over time bug that prevented it deal damage if it was following a target and had "!damagefollowingtarget" flag. - added callback on blend in /out for death related VFX --- .../PlayerDeathVFXManager.prefab | 8 ++ .../Prefabs/UI/AbilityBindInstance.prefab | 80 ++++++++++++++++++- Assets/Resources/PlayerPrefab.prefab | 59 ++++++++++++-- ...neStorm_UltimateAreaOfEffectOverTime.asset | 4 +- .../2-WhirlingAxes_AoEOverTimeAbility.asset | 2 +- .../3-RageStorm_ChanneledAbility.asset | 2 +- .../3-ConsecrationAoEOverTimeAbility.asset | 2 +- .../Mage/1-IceShard_ProjectileAbility.asset | 2 +- .../Mage/2-Blizzard_AoEOverTimeAbility.asset | 2 +- ...lacialBomb_AoEWithImpactEventAbility.asset | 4 +- .../3-HolyCircleAoEOverTimeAbility.asset | 2 +- .../BoneStorm_InstantTickEffect.asset | 2 +- .../NetworkedAreaOfEffectOverTime.cs | 3 +- Assets/Scripts/Networking/NetworkedSlash.cs | 5 +- Assets/Scripts/Player/AbilityKeyBinder.cs | 32 +++++++- Assets/Scripts/Player/PlayerDeathVFX.cs | 17 ++-- .../Scripts/Player/PlayerDeathVFXManager.cs | 13 +-- Assets/Scripts/UI/AbilityBindInstance.cs | 29 +++++++ Assets/Starfield Skybox/Skybox.mat | 2 +- 19 files changed, 230 insertions(+), 40 deletions(-) diff --git a/Assets/Developer/Prefabs/PostProcessing/PlayerDeathVFXManager.prefab b/Assets/Developer/Prefabs/PostProcessing/PlayerDeathVFXManager.prefab index a1a94727..f030ca51 100644 --- a/Assets/Developer/Prefabs/PostProcessing/PlayerDeathVFXManager.prefab +++ b/Assets/Developer/Prefabs/PostProcessing/PlayerDeathVFXManager.prefab @@ -416,6 +416,10 @@ PrefabInstance: m_Modification: m_TransformParent: {fileID: 7020428284878135822} m_Modifications: + - target: {fileID: 2581063911378104661, guid: 53f88934a01f4d84f876b8a560763739, type: 3} + propertyPath: priority + value: 110 + objectReference: {fileID: 0} - target: {fileID: 4783346110133923095, guid: 53f88934a01f4d84f876b8a560763739, type: 3} propertyPath: m_RootOrder value: 1 @@ -489,6 +493,10 @@ PrefabInstance: m_Modification: m_TransformParent: {fileID: 7020428284878135822} m_Modifications: + - target: {fileID: 1760825799394209988, guid: c3f2d2df486cdf041b345045200ee376, type: 3} + propertyPath: priority + value: 120 + objectReference: {fileID: 0} - target: {fileID: 6741952868805698281, guid: c3f2d2df486cdf041b345045200ee376, type: 3} propertyPath: m_Name value: PermaDeath_PostProcessingVolume diff --git a/Assets/Developer/Prefabs/UI/AbilityBindInstance.prefab b/Assets/Developer/Prefabs/UI/AbilityBindInstance.prefab index 61204714..35a14c5b 100644 --- a/Assets/Developer/Prefabs/UI/AbilityBindInstance.prefab +++ b/Assets/Developer/Prefabs/UI/AbilityBindInstance.prefab @@ -211,6 +211,82 @@ MonoBehaviour: m_hasFontAssetChanged: 0 m_baseMaterial: {fileID: 0} m_maskOffset: {x: 0, y: 0, z: 0, w: 0} +--- !u!1 &4128365416075155250 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 6774970707153163240} + - component: {fileID: 1557625133160996104} + - component: {fileID: 2413958677162281131} + m_Layer: 5 + m_Name: Cooldown + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!224 &6774970707153163240 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4128365416075155250} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 5756525528600931364} + m_RootOrder: 5 + 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: -10.000004} + m_SizeDelta: {x: 0, y: -19.999992} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &1557625133160996104 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4128365416075155250} + m_CullTransparentMesh: 1 +--- !u!114 &2413958677162281131 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4128365416075155250} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.122641504, g: 0.122641504, b: 0.122641504, 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: 66efb24ed46044ab8a039599cbc47d7b, type: 3} + m_Type: 3 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 --- !u!1 &4444551169812095635 GameObject: m_ObjectHideFlags: 0 @@ -400,6 +476,7 @@ RectTransform: - {fileID: 4877649046481684198} - {fileID: 3213720952488904518} - {fileID: 2240116213718434170} + - {fileID: 6774970707153163240} - {fileID: 8015528414007822456} m_Father: {fileID: 0} m_RootOrder: 0 @@ -466,6 +543,7 @@ MonoBehaviour: icon: {fileID: 8702117578033848689} noMana: {fileID: 5122095429438571753} pressed: {fileID: 4444551169812095635} + coolDown: {fileID: 2413958677162281131} abilityKeyBinder: {fileID: 0} --- !u!1 &7629378981540427907 GameObject: @@ -753,7 +831,7 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 5756525528600931364} - m_RootOrder: 5 + m_RootOrder: 6 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} diff --git a/Assets/Resources/PlayerPrefab.prefab b/Assets/Resources/PlayerPrefab.prefab index 85a09bcb..93b9095d 100644 --- a/Assets/Resources/PlayerPrefab.prefab +++ b/Assets/Resources/PlayerPrefab.prefab @@ -245,6 +245,7 @@ Transform: - {fileID: 3772225982209654621} - {fileID: 5381484259768238931} - {fileID: 532445120323741062} + - {fileID: 3312432933440124539} - {fileID: 1461139431720500781} - {fileID: 5096391556985444266} - {fileID: 3517291064683520329} @@ -890,6 +891,50 @@ MonoBehaviour: Response: m_PersistentCalls: m_Calls: [] +--- !u!1 &2135173956698246275 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 3312432933440124539} + - component: {fileID: 7276298589767359756} + m_Layer: 0 + m_Name: AbilityCooldownTracker + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &3312432933440124539 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2135173956698246275} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 8785094005405139760} + m_RootOrder: 12 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &7276298589767359756 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2135173956698246275} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 44a1a7128e1e3be42b0b93149caa639d, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!1 &2135858923112608605 GameObject: m_ObjectHideFlags: 0 @@ -1098,7 +1143,7 @@ Transform: - {fileID: 5039314715756572421} - {fileID: 5447783134482355923} m_Father: {fileID: 8785094005405139760} - m_RootOrder: 17 + m_RootOrder: 18 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!114 &3993657840148777867 MonoBehaviour: @@ -1120,9 +1165,7 @@ MonoBehaviour: bleedOutProgressGO: {fileID: 9102572405850637775} reviveProgressFill: {fileID: 3216778857540899709} bleedOutProgressFill: {fileID: 1417942816497691017} - onPlayerSpawned: {fileID: 1248313421135328660} playersInsideReviveTrigger: [] - playersDeathManagers: [] --- !u!54 &292444422420756798 Rigidbody: m_ObjectHideFlags: 0 @@ -2408,7 +2451,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 5096391557067247094, guid: 9307008512a9c1c45ac122516378acfa, type: 3} propertyPath: m_RootOrder - value: 13 + value: 14 objectReference: {fileID: 0} - target: {fileID: 5096391557067247094, guid: 9307008512a9c1c45ac122516378acfa, type: 3} propertyPath: m_LocalPosition.x @@ -2491,7 +2534,7 @@ PrefabInstance: m_Modifications: - target: {fileID: 5102692018217329649, guid: fa51093b89e20f34b96ab90f7cce2083, type: 3} propertyPath: m_RootOrder - value: 15 + value: 16 objectReference: {fileID: 0} - target: {fileID: 5102692018217329649, guid: fa51093b89e20f34b96ab90f7cce2083, type: 3} propertyPath: m_LocalPosition.x @@ -2652,7 +2695,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 4548947268890891932, guid: b197ddc3f3f9fde488980766678344bb, type: 3} propertyPath: m_RootOrder - value: 12 + value: 13 objectReference: {fileID: 0} - target: {fileID: 4548947268890891932, guid: b197ddc3f3f9fde488980766678344bb, type: 3} propertyPath: m_LocalPosition.x @@ -2811,7 +2854,7 @@ PrefabInstance: m_Modifications: - target: {fileID: 6294508013172393185, guid: 043176b6a68be2b43b073aaaa4782c7d, type: 3} propertyPath: m_RootOrder - value: 16 + value: 17 objectReference: {fileID: 0} - target: {fileID: 6294508013172393185, guid: 043176b6a68be2b43b073aaaa4782c7d, type: 3} propertyPath: m_LocalPosition.x @@ -3090,7 +3133,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 5259537852706133517, guid: 23e24e9936f1c6f4baaaef83461437db, type: 3} propertyPath: m_RootOrder - value: 14 + value: 15 objectReference: {fileID: 0} - target: {fileID: 5259537852706133517, guid: 23e24e9936f1c6f4baaaef83461437db, type: 3} propertyPath: m_LocalPosition.x diff --git a/Assets/Scriptables/Data/Abilities/Debug/NPC/-Boss/AngrySkelly/Ultimate/Boss_Skelly_BoneStorm_UltimateAreaOfEffectOverTime.asset b/Assets/Scriptables/Data/Abilities/Debug/NPC/-Boss/AngrySkelly/Ultimate/Boss_Skelly_BoneStorm_UltimateAreaOfEffectOverTime.asset index 593ed09a..19de43e8 100644 --- a/Assets/Scriptables/Data/Abilities/Debug/NPC/-Boss/AngrySkelly/Ultimate/Boss_Skelly_BoneStorm_UltimateAreaOfEffectOverTime.asset +++ b/Assets/Scriptables/Data/Abilities/Debug/NPC/-Boss/AngrySkelly/Ultimate/Boss_Skelly_BoneStorm_UltimateAreaOfEffectOverTime.asset @@ -23,7 +23,7 @@ MonoBehaviour: castTime: 0 manaCost: 10 healthCost: 0 - cooldown: 5 + cooldown: 6 castableWhileMoving: 0 animationType: 0 aoePrefab: {fileID: 758050341675869817, guid: 5245a1dc9755eec42adf1f51b0c52d08, type: 3} @@ -39,4 +39,4 @@ MonoBehaviour: duration: 3 followUser: 0 followTarget: 1 - damageFollowingTarget: 0 + damageFollowingTarget: 1 diff --git a/Assets/Scriptables/Data/Abilities/Debug/Player/Barbarian/2-WhirlingAxes_AoEOverTimeAbility.asset b/Assets/Scriptables/Data/Abilities/Debug/Player/Barbarian/2-WhirlingAxes_AoEOverTimeAbility.asset index 5216d735..302c4ab6 100644 --- a/Assets/Scriptables/Data/Abilities/Debug/Player/Barbarian/2-WhirlingAxes_AoEOverTimeAbility.asset +++ b/Assets/Scriptables/Data/Abilities/Debug/Player/Barbarian/2-WhirlingAxes_AoEOverTimeAbility.asset @@ -25,7 +25,7 @@ MonoBehaviour: castTime: 0.25 manaCost: 20 healthCost: 0 - cooldown: 0 + cooldown: 2 castableWhileMoving: 0 animationType: 0 aoePrefab: {fileID: 5286231604687820132, guid: e6bc5808d58f0ba4fbe3d5674f60b526, type: 3} diff --git a/Assets/Scriptables/Data/Abilities/Debug/Player/Barbarian/3-RageStorm_ChanneledAbility.asset b/Assets/Scriptables/Data/Abilities/Debug/Player/Barbarian/3-RageStorm_ChanneledAbility.asset index 3c75f967..6bed963a 100644 --- a/Assets/Scriptables/Data/Abilities/Debug/Player/Barbarian/3-RageStorm_ChanneledAbility.asset +++ b/Assets/Scriptables/Data/Abilities/Debug/Player/Barbarian/3-RageStorm_ChanneledAbility.asset @@ -28,7 +28,7 @@ MonoBehaviour: castTime: 0 manaCost: 50 healthCost: 0 - cooldown: 0 + cooldown: 10 castableWhileMoving: 1 animationType: 3 prefab: {fileID: 1004020196762887022, guid: f9e892cd18bc2de4cb277f7d3459b200, type: 3} diff --git a/Assets/Scriptables/Data/Abilities/Debug/Player/Knight/3-ConsecrationAoEOverTimeAbility.asset b/Assets/Scriptables/Data/Abilities/Debug/Player/Knight/3-ConsecrationAoEOverTimeAbility.asset index a319ed8a..ce1c3877 100644 --- a/Assets/Scriptables/Data/Abilities/Debug/Player/Knight/3-ConsecrationAoEOverTimeAbility.asset +++ b/Assets/Scriptables/Data/Abilities/Debug/Player/Knight/3-ConsecrationAoEOverTimeAbility.asset @@ -28,7 +28,7 @@ MonoBehaviour: castTime: 0.5 manaCost: 50 healthCost: 0 - cooldown: 0 + cooldown: 3 castableWhileMoving: 0 animationType: 1 aoePrefab: {fileID: 242799163458536464, guid: 1f4bc3f1d82c9554486c4e7e3bde86fc, type: 3} diff --git a/Assets/Scriptables/Data/Abilities/Debug/Player/Mage/1-IceShard_ProjectileAbility.asset b/Assets/Scriptables/Data/Abilities/Debug/Player/Mage/1-IceShard_ProjectileAbility.asset index a3026427..6457752e 100644 --- a/Assets/Scriptables/Data/Abilities/Debug/Player/Mage/1-IceShard_ProjectileAbility.asset +++ b/Assets/Scriptables/Data/Abilities/Debug/Player/Mage/1-IceShard_ProjectileAbility.asset @@ -21,7 +21,7 @@ MonoBehaviour: - {fileID: 11400000, guid: 52f094018088de54ab9507695f2913b7, type: 2} abilityEffects: - {fileID: 11400000, guid: d441f01dcc2dc5943a605b0bbffa1a03, type: 2} - castTime: 0.75 + castTime: 0.5 manaCost: 6 healthCost: 0 cooldown: 0 diff --git a/Assets/Scriptables/Data/Abilities/Debug/Player/Mage/2-Blizzard_AoEOverTimeAbility.asset b/Assets/Scriptables/Data/Abilities/Debug/Player/Mage/2-Blizzard_AoEOverTimeAbility.asset index f13329ea..2218ffe7 100644 --- a/Assets/Scriptables/Data/Abilities/Debug/Player/Mage/2-Blizzard_AoEOverTimeAbility.asset +++ b/Assets/Scriptables/Data/Abilities/Debug/Player/Mage/2-Blizzard_AoEOverTimeAbility.asset @@ -24,7 +24,7 @@ MonoBehaviour: castTime: 0.5 manaCost: 20 healthCost: 0 - cooldown: 0 + cooldown: 2 castableWhileMoving: 0 animationType: 1 aoePrefab: {fileID: 7332445597516000773, guid: 49d4c037b88cfc54a9fe2d4a84012145, type: 3} diff --git a/Assets/Scriptables/Data/Abilities/Debug/Player/Mage/3-GlacialBomb_AoEWithImpactEventAbility.asset b/Assets/Scriptables/Data/Abilities/Debug/Player/Mage/3-GlacialBomb_AoEWithImpactEventAbility.asset index 413c1c29..196e22e4 100644 --- a/Assets/Scriptables/Data/Abilities/Debug/Player/Mage/3-GlacialBomb_AoEWithImpactEventAbility.asset +++ b/Assets/Scriptables/Data/Abilities/Debug/Player/Mage/3-GlacialBomb_AoEWithImpactEventAbility.asset @@ -22,10 +22,10 @@ MonoBehaviour: - {fileID: 11400000, guid: 8b74e81cfcd772243b988990f4a8a634, type: 2} abilityEffects: - {fileID: 11400000, guid: db121d164df0dac4980d3d5e61327b40, type: 2} - castTime: 1 + castTime: 0.75 manaCost: 60 healthCost: 0 - cooldown: 0 + cooldown: 3 castableWhileMoving: 0 animationType: 1 aoePrefab: {fileID: 7535207197812752309, guid: 263ed363454525d46aefa46b653b419d, type: 3} diff --git a/Assets/Scriptables/Data/Abilities/Debug/Player/Priest/3-HolyCircleAoEOverTimeAbility.asset b/Assets/Scriptables/Data/Abilities/Debug/Player/Priest/3-HolyCircleAoEOverTimeAbility.asset index c54a9c4c..1e186f26 100644 --- a/Assets/Scriptables/Data/Abilities/Debug/Player/Priest/3-HolyCircleAoEOverTimeAbility.asset +++ b/Assets/Scriptables/Data/Abilities/Debug/Player/Priest/3-HolyCircleAoEOverTimeAbility.asset @@ -26,7 +26,7 @@ MonoBehaviour: castTime: 1 manaCost: 80 healthCost: 0 - cooldown: 0 + cooldown: 3 castableWhileMoving: 0 animationType: 1 aoePrefab: {fileID: 7455199422598815824, guid: b1f35b67c9e638443a850c78c0f87ac5, type: 3} diff --git a/Assets/Scriptables/Data/Effects/Debug/NPC/Boss/AngrySkellyBoss/Ultimate/BoneStorm_InstantTickEffect.asset b/Assets/Scriptables/Data/Effects/Debug/NPC/Boss/AngrySkellyBoss/Ultimate/BoneStorm_InstantTickEffect.asset index 364249aa..607b6a7b 100644 --- a/Assets/Scriptables/Data/Effects/Debug/NPC/Boss/AngrySkellyBoss/Ultimate/BoneStorm_InstantTickEffect.asset +++ b/Assets/Scriptables/Data/Effects/Debug/NPC/Boss/AngrySkellyBoss/Ultimate/BoneStorm_InstantTickEffect.asset @@ -17,6 +17,6 @@ MonoBehaviour: influencingStats: - statTag: {fileID: 11400000, guid: 8b74e81cfcd772243b988990f4a8a634, type: 2} percentInfluence: 0.3 - baseValue: 5 + baseValue: 2 AlliedTargetMultiplier: 1 EnemyTargetMultiplier: 1 diff --git a/Assets/Scripts/Networking/NetworkedAreaOfEffectOverTime.cs b/Assets/Scripts/Networking/NetworkedAreaOfEffectOverTime.cs index 8f88b7be..cb6c2853 100644 --- a/Assets/Scripts/Networking/NetworkedAreaOfEffectOverTime.cs +++ b/Assets/Scripts/Networking/NetworkedAreaOfEffectOverTime.cs @@ -52,6 +52,7 @@ public class NetworkedAreaOfEffectOverTime : NetworkedAreaOfEffect IEnumerator FollowTransform(Transform target) { + endTime = Time.time + duration; while (Time.time < endTime) { this.transform.position = target.position; @@ -110,7 +111,7 @@ public class NetworkedAreaOfEffectOverTime : NetworkedAreaOfEffect if (target == null) continue; - if (followTarget && !damageFollowingTarget && target == followingTargetTaggable) return; + if (followTarget && (!damageFollowingTarget && target == followingTargetTaggable)) continue; //Debug.Log("hit collider, targetTag: " + target.targetTag.name); diff --git a/Assets/Scripts/Networking/NetworkedSlash.cs b/Assets/Scripts/Networking/NetworkedSlash.cs index 821a1d7c..156ea96c 100644 --- a/Assets/Scripts/Networking/NetworkedSlash.cs +++ b/Assets/Scripts/Networking/NetworkedSlash.cs @@ -119,12 +119,13 @@ public class NetworkedSlash : MonoBehaviour Debug.Log("hit collider, targetTag: " + target.targetTag.name); + + if (!target.IsValidTarget(ability.targettingTags)) continue; + hitPositionCorrected = target.transform.position; hitPositionCorrected.y = this.transform.position.y; onTargetHit.Invoke(hitPositionCorrected); - if (!target.IsValidTarget(ability.targettingTags)) continue; - Debug.Log("hit collider, added target: " + target.name); targets.Add(target); } diff --git a/Assets/Scripts/Player/AbilityKeyBinder.cs b/Assets/Scripts/Player/AbilityKeyBinder.cs index f9311fe6..a78481ce 100644 --- a/Assets/Scripts/Player/AbilityKeyBinder.cs +++ b/Assets/Scripts/Player/AbilityKeyBinder.cs @@ -26,6 +26,7 @@ public class AbilityKeyBinder : MonoBehaviour Coroutine currentChanneling; NetworkedChanneling networkedChanneling; AbilityBindInstance abilityBindInstance; + AbilityCooldownTracker cooldownTracker; bool isDead = false; @@ -34,7 +35,7 @@ public class AbilityKeyBinder : MonoBehaviour user = GetComponentInParent(); userTag = GetComponentInParent(); mana = GetComponentInParent(); - + cooldownTracker = user.GetComponentInChildren(); } private void Start() @@ -72,14 +73,32 @@ public class AbilityKeyBinder : MonoBehaviour { if (abilityBindInstance != null) abilityBindInstance.pressed.SetActive(true); - if (mana.EnoughMana(ability.manaCost)) + if (IsAbilityOffCooldown() && mana.EnoughMana(ability.manaCost)) { if (ability is ChanneledAbility) { - castingStateController.RequestAbilityChannel(ability, () => networkedChanneling = ((ChanneledAbility)ability).ExecuteChannel(user, userTag, ref currentChanneling)); + castingStateController.RequestAbilityChannel(ability, () => + { + networkedChanneling = ((ChanneledAbility)ability).ExecuteChannel(user, userTag, ref currentChanneling); + if (ability.cooldown > 0) + { + cooldownTracker.StartAbilityCooldown(ability); + abilityBindInstance.StartCooldownTrackerUI(); + } + }); } else - castingStateController.RequestAbilityCast(ability, () => ability.Execute(user, userTag)); + { + castingStateController.RequestAbilityCast(ability, () => + { + ability.Execute(user, userTag); + if (ability.cooldown > 0) + { + cooldownTracker.StartAbilityCooldown(ability); + abilityBindInstance.StartCooldownTrackerUI(); + } + }); + } } } if (Input.GetKeyUp(key.keyCode)) @@ -111,4 +130,9 @@ public class AbilityKeyBinder : MonoBehaviour { abilityBindInstance.noMana.SetActive(!mana.EnoughMana(ability.manaCost)); } + + public bool IsAbilityOffCooldown() + { + return ability.cooldown <= 0 || !cooldownTracker.OnCooldown(ability); + } } diff --git a/Assets/Scripts/Player/PlayerDeathVFX.cs b/Assets/Scripts/Player/PlayerDeathVFX.cs index e95e79d7..2527ffb7 100644 --- a/Assets/Scripts/Player/PlayerDeathVFX.cs +++ b/Assets/Scripts/Player/PlayerDeathVFX.cs @@ -1,3 +1,4 @@ +using System; using System.Collections; using System.Collections.Generic; using UnityEngine; @@ -16,16 +17,16 @@ public class PlayerDeathVFX : MonoBehaviour postProcess = GetComponent(); } - public void BlendIn() + public void BlendIn(Action callback = null) { StopBlendCoroutine(); - blendCoroutine = StartCoroutine(BlendWeight(0f, 1f, blendDuration)); + blendCoroutine = StartCoroutine(BlendWeight(0f, 1f, blendDuration, callback)); } - public void BlendOut() + public void BlendOut(Action callback = null) { StopBlendCoroutine(); - blendCoroutine = StartCoroutine(BlendWeight(1f, 0f, blendDuration)); + blendCoroutine = StartCoroutine(BlendWeight(1f, 0f, blendDuration, callback)); } public void ResetWeight() @@ -33,13 +34,13 @@ public class PlayerDeathVFX : MonoBehaviour postProcess.weight = 0; } - public void BlendTo(float targetWeight) + public void BlendTo(float targetWeight, Action callback = null) { StopBlendCoroutine(); - blendCoroutine = StartCoroutine(BlendWeight(postProcess.weight, targetWeight, blendDuration)); + blendCoroutine = StartCoroutine(BlendWeight(postProcess.weight, targetWeight, blendDuration, callback)); } - private IEnumerator BlendWeight(float startWeight, float endWeight, float duration) + private IEnumerator BlendWeight(float startWeight, float endWeight, float duration, Action callback = null) { float elapsedTime = 0f; @@ -52,6 +53,8 @@ public class PlayerDeathVFX : MonoBehaviour } postProcess.weight = endWeight; + if (callback != null) + callback.Invoke(); } private void StopBlendCoroutine() diff --git a/Assets/Scripts/Player/PlayerDeathVFXManager.cs b/Assets/Scripts/Player/PlayerDeathVFXManager.cs index 77924b36..cc2ce879 100644 --- a/Assets/Scripts/Player/PlayerDeathVFXManager.cs +++ b/Assets/Scripts/Player/PlayerDeathVFXManager.cs @@ -1,3 +1,4 @@ +using System; using System.Collections; using System.Collections.Generic; using UnityEngine; @@ -74,9 +75,11 @@ public class PlayerDeathVFXManager : MonoBehaviour } private void OnLocalPermaDeath() { - cheatedDeathVFX.ResetWeight(); - faintedVFX.ResetWeight(); - EnablePermaDeathVFX(); + EnablePermaDeathVFX(() => + { + cheatedDeathVFX.ResetWeight(); + faintedVFX.ResetWeight(); + }); cheatedDeathText.SetActive(false); faintedText.SetActive(false); @@ -120,9 +123,9 @@ public class PlayerDeathVFXManager : MonoBehaviour faintedText.SetActive(false); } - public void EnablePermaDeathVFX() + public void EnablePermaDeathVFX(Action callback = null) { - permaDeathVFX.BlendIn(); + permaDeathVFX.BlendIn(callback); permaDeathText.SetActive(true); } public void DisablePermaDeathVFX() diff --git a/Assets/Scripts/UI/AbilityBindInstance.cs b/Assets/Scripts/UI/AbilityBindInstance.cs index 35a24a59..5d6ad109 100644 --- a/Assets/Scripts/UI/AbilityBindInstance.cs +++ b/Assets/Scripts/UI/AbilityBindInstance.cs @@ -14,6 +14,7 @@ public class AbilityBindInstance : MonoBehaviour public Image icon; public GameObject noMana; public GameObject pressed; + public Image coolDown; [Header("Set by Code:")] public AbilityKeyBinder abilityKeyBinder; @@ -36,7 +37,35 @@ public class AbilityBindInstance : MonoBehaviour this.icon.sprite = abilityKeyBinder.Ability.Icon; noMana.SetActive(false); pressed.SetActive(false); + coolDown.fillAmount = 1; + coolDown.gameObject.SetActive(false); abilityKeyBinder.SetupAbilityBindInstance(this); } + + public void StartCooldownTrackerUI() + { + StartCoroutine(UIAbilityCooldownTracking()); + } + + float cooldownTime; + float elapsedTime; + IEnumerator UIAbilityCooldownTracking() + { + cooldownTime = abilityKeyBinder.Ability.cooldown; + elapsedTime = 0f; + + coolDown.fillAmount = 1f; + coolDown.gameObject.SetActive(true); + + while (elapsedTime < cooldownTime) + { + elapsedTime += Time.deltaTime; + coolDown.fillAmount = 1f - (elapsedTime / cooldownTime); + yield return null; + } + + coolDown.fillAmount = 0f; + coolDown.gameObject.SetActive(false); + } } diff --git a/Assets/Starfield Skybox/Skybox.mat b/Assets/Starfield Skybox/Skybox.mat index 11da212c..2361631a 100644 --- a/Assets/Starfield Skybox/Skybox.mat +++ b/Assets/Starfield Skybox/Skybox.mat @@ -94,7 +94,7 @@ Material: - _Mode: 0 - _OcclusionStrength: 1 - _Parallax: 0.02 - - _Rotation: 19.208542 + - _Rotation: 6.564019 - _SmoothnessTextureChannel: 0 - _SpecularHighlights: 1 - _SrcBlend: 1