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
This commit is contained in:
Pedro Gomes 2024-07-21 11:05:48 +01:00
parent 626d554a51
commit 5a48a23de1
19 changed files with 230 additions and 40 deletions

View File

@ -416,6 +416,10 @@ PrefabInstance:
m_Modification: m_Modification:
m_TransformParent: {fileID: 7020428284878135822} m_TransformParent: {fileID: 7020428284878135822}
m_Modifications: m_Modifications:
- target: {fileID: 2581063911378104661, guid: 53f88934a01f4d84f876b8a560763739, type: 3}
propertyPath: priority
value: 110
objectReference: {fileID: 0}
- target: {fileID: 4783346110133923095, guid: 53f88934a01f4d84f876b8a560763739, type: 3} - target: {fileID: 4783346110133923095, guid: 53f88934a01f4d84f876b8a560763739, type: 3}
propertyPath: m_RootOrder propertyPath: m_RootOrder
value: 1 value: 1
@ -489,6 +493,10 @@ PrefabInstance:
m_Modification: m_Modification:
m_TransformParent: {fileID: 7020428284878135822} m_TransformParent: {fileID: 7020428284878135822}
m_Modifications: m_Modifications:
- target: {fileID: 1760825799394209988, guid: c3f2d2df486cdf041b345045200ee376, type: 3}
propertyPath: priority
value: 120
objectReference: {fileID: 0}
- target: {fileID: 6741952868805698281, guid: c3f2d2df486cdf041b345045200ee376, type: 3} - target: {fileID: 6741952868805698281, guid: c3f2d2df486cdf041b345045200ee376, type: 3}
propertyPath: m_Name propertyPath: m_Name
value: PermaDeath_PostProcessingVolume value: PermaDeath_PostProcessingVolume

View File

@ -211,6 +211,82 @@ MonoBehaviour:
m_hasFontAssetChanged: 0 m_hasFontAssetChanged: 0
m_baseMaterial: {fileID: 0} m_baseMaterial: {fileID: 0}
m_maskOffset: {x: 0, y: 0, z: 0, w: 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 --- !u!1 &4444551169812095635
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -400,6 +476,7 @@ RectTransform:
- {fileID: 4877649046481684198} - {fileID: 4877649046481684198}
- {fileID: 3213720952488904518} - {fileID: 3213720952488904518}
- {fileID: 2240116213718434170} - {fileID: 2240116213718434170}
- {fileID: 6774970707153163240}
- {fileID: 8015528414007822456} - {fileID: 8015528414007822456}
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 0 m_RootOrder: 0
@ -466,6 +543,7 @@ MonoBehaviour:
icon: {fileID: 8702117578033848689} icon: {fileID: 8702117578033848689}
noMana: {fileID: 5122095429438571753} noMana: {fileID: 5122095429438571753}
pressed: {fileID: 4444551169812095635} pressed: {fileID: 4444551169812095635}
coolDown: {fileID: 2413958677162281131}
abilityKeyBinder: {fileID: 0} abilityKeyBinder: {fileID: 0}
--- !u!1 &7629378981540427907 --- !u!1 &7629378981540427907
GameObject: GameObject:
@ -753,7 +831,7 @@ RectTransform:
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: [] m_Children: []
m_Father: {fileID: 5756525528600931364} m_Father: {fileID: 5756525528600931364}
m_RootOrder: 5 m_RootOrder: 6
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5}

View File

@ -245,6 +245,7 @@ Transform:
- {fileID: 3772225982209654621} - {fileID: 3772225982209654621}
- {fileID: 5381484259768238931} - {fileID: 5381484259768238931}
- {fileID: 532445120323741062} - {fileID: 532445120323741062}
- {fileID: 3312432933440124539}
- {fileID: 1461139431720500781} - {fileID: 1461139431720500781}
- {fileID: 5096391556985444266} - {fileID: 5096391556985444266}
- {fileID: 3517291064683520329} - {fileID: 3517291064683520329}
@ -890,6 +891,50 @@ MonoBehaviour:
Response: Response:
m_PersistentCalls: m_PersistentCalls:
m_Calls: [] 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 --- !u!1 &2135858923112608605
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -1098,7 +1143,7 @@ Transform:
- {fileID: 5039314715756572421} - {fileID: 5039314715756572421}
- {fileID: 5447783134482355923} - {fileID: 5447783134482355923}
m_Father: {fileID: 8785094005405139760} m_Father: {fileID: 8785094005405139760}
m_RootOrder: 17 m_RootOrder: 18
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &3993657840148777867 --- !u!114 &3993657840148777867
MonoBehaviour: MonoBehaviour:
@ -1120,9 +1165,7 @@ MonoBehaviour:
bleedOutProgressGO: {fileID: 9102572405850637775} bleedOutProgressGO: {fileID: 9102572405850637775}
reviveProgressFill: {fileID: 3216778857540899709} reviveProgressFill: {fileID: 3216778857540899709}
bleedOutProgressFill: {fileID: 1417942816497691017} bleedOutProgressFill: {fileID: 1417942816497691017}
onPlayerSpawned: {fileID: 1248313421135328660}
playersInsideReviveTrigger: [] playersInsideReviveTrigger: []
playersDeathManagers: []
--- !u!54 &292444422420756798 --- !u!54 &292444422420756798
Rigidbody: Rigidbody:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -2408,7 +2451,7 @@ PrefabInstance:
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 5096391557067247094, guid: 9307008512a9c1c45ac122516378acfa, type: 3} - target: {fileID: 5096391557067247094, guid: 9307008512a9c1c45ac122516378acfa, type: 3}
propertyPath: m_RootOrder propertyPath: m_RootOrder
value: 13 value: 14
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 5096391557067247094, guid: 9307008512a9c1c45ac122516378acfa, type: 3} - target: {fileID: 5096391557067247094, guid: 9307008512a9c1c45ac122516378acfa, type: 3}
propertyPath: m_LocalPosition.x propertyPath: m_LocalPosition.x
@ -2491,7 +2534,7 @@ PrefabInstance:
m_Modifications: m_Modifications:
- target: {fileID: 5102692018217329649, guid: fa51093b89e20f34b96ab90f7cce2083, type: 3} - target: {fileID: 5102692018217329649, guid: fa51093b89e20f34b96ab90f7cce2083, type: 3}
propertyPath: m_RootOrder propertyPath: m_RootOrder
value: 15 value: 16
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 5102692018217329649, guid: fa51093b89e20f34b96ab90f7cce2083, type: 3} - target: {fileID: 5102692018217329649, guid: fa51093b89e20f34b96ab90f7cce2083, type: 3}
propertyPath: m_LocalPosition.x propertyPath: m_LocalPosition.x
@ -2652,7 +2695,7 @@ PrefabInstance:
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 4548947268890891932, guid: b197ddc3f3f9fde488980766678344bb, type: 3} - target: {fileID: 4548947268890891932, guid: b197ddc3f3f9fde488980766678344bb, type: 3}
propertyPath: m_RootOrder propertyPath: m_RootOrder
value: 12 value: 13
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 4548947268890891932, guid: b197ddc3f3f9fde488980766678344bb, type: 3} - target: {fileID: 4548947268890891932, guid: b197ddc3f3f9fde488980766678344bb, type: 3}
propertyPath: m_LocalPosition.x propertyPath: m_LocalPosition.x
@ -2811,7 +2854,7 @@ PrefabInstance:
m_Modifications: m_Modifications:
- target: {fileID: 6294508013172393185, guid: 043176b6a68be2b43b073aaaa4782c7d, type: 3} - target: {fileID: 6294508013172393185, guid: 043176b6a68be2b43b073aaaa4782c7d, type: 3}
propertyPath: m_RootOrder propertyPath: m_RootOrder
value: 16 value: 17
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 6294508013172393185, guid: 043176b6a68be2b43b073aaaa4782c7d, type: 3} - target: {fileID: 6294508013172393185, guid: 043176b6a68be2b43b073aaaa4782c7d, type: 3}
propertyPath: m_LocalPosition.x propertyPath: m_LocalPosition.x
@ -3090,7 +3133,7 @@ PrefabInstance:
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 5259537852706133517, guid: 23e24e9936f1c6f4baaaef83461437db, type: 3} - target: {fileID: 5259537852706133517, guid: 23e24e9936f1c6f4baaaef83461437db, type: 3}
propertyPath: m_RootOrder propertyPath: m_RootOrder
value: 14 value: 15
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 5259537852706133517, guid: 23e24e9936f1c6f4baaaef83461437db, type: 3} - target: {fileID: 5259537852706133517, guid: 23e24e9936f1c6f4baaaef83461437db, type: 3}
propertyPath: m_LocalPosition.x propertyPath: m_LocalPosition.x

View File

@ -23,7 +23,7 @@ MonoBehaviour:
castTime: 0 castTime: 0
manaCost: 10 manaCost: 10
healthCost: 0 healthCost: 0
cooldown: 5 cooldown: 6
castableWhileMoving: 0 castableWhileMoving: 0
animationType: 0 animationType: 0
aoePrefab: {fileID: 758050341675869817, guid: 5245a1dc9755eec42adf1f51b0c52d08, type: 3} aoePrefab: {fileID: 758050341675869817, guid: 5245a1dc9755eec42adf1f51b0c52d08, type: 3}
@ -39,4 +39,4 @@ MonoBehaviour:
duration: 3 duration: 3
followUser: 0 followUser: 0
followTarget: 1 followTarget: 1
damageFollowingTarget: 0 damageFollowingTarget: 1

View File

@ -25,7 +25,7 @@ MonoBehaviour:
castTime: 0.25 castTime: 0.25
manaCost: 20 manaCost: 20
healthCost: 0 healthCost: 0
cooldown: 0 cooldown: 2
castableWhileMoving: 0 castableWhileMoving: 0
animationType: 0 animationType: 0
aoePrefab: {fileID: 5286231604687820132, guid: e6bc5808d58f0ba4fbe3d5674f60b526, type: 3} aoePrefab: {fileID: 5286231604687820132, guid: e6bc5808d58f0ba4fbe3d5674f60b526, type: 3}

View File

@ -28,7 +28,7 @@ MonoBehaviour:
castTime: 0 castTime: 0
manaCost: 50 manaCost: 50
healthCost: 0 healthCost: 0
cooldown: 0 cooldown: 10
castableWhileMoving: 1 castableWhileMoving: 1
animationType: 3 animationType: 3
prefab: {fileID: 1004020196762887022, guid: f9e892cd18bc2de4cb277f7d3459b200, type: 3} prefab: {fileID: 1004020196762887022, guid: f9e892cd18bc2de4cb277f7d3459b200, type: 3}

View File

@ -28,7 +28,7 @@ MonoBehaviour:
castTime: 0.5 castTime: 0.5
manaCost: 50 manaCost: 50
healthCost: 0 healthCost: 0
cooldown: 0 cooldown: 3
castableWhileMoving: 0 castableWhileMoving: 0
animationType: 1 animationType: 1
aoePrefab: {fileID: 242799163458536464, guid: 1f4bc3f1d82c9554486c4e7e3bde86fc, type: 3} aoePrefab: {fileID: 242799163458536464, guid: 1f4bc3f1d82c9554486c4e7e3bde86fc, type: 3}

View File

@ -21,7 +21,7 @@ MonoBehaviour:
- {fileID: 11400000, guid: 52f094018088de54ab9507695f2913b7, type: 2} - {fileID: 11400000, guid: 52f094018088de54ab9507695f2913b7, type: 2}
abilityEffects: abilityEffects:
- {fileID: 11400000, guid: d441f01dcc2dc5943a605b0bbffa1a03, type: 2} - {fileID: 11400000, guid: d441f01dcc2dc5943a605b0bbffa1a03, type: 2}
castTime: 0.75 castTime: 0.5
manaCost: 6 manaCost: 6
healthCost: 0 healthCost: 0
cooldown: 0 cooldown: 0

View File

@ -24,7 +24,7 @@ MonoBehaviour:
castTime: 0.5 castTime: 0.5
manaCost: 20 manaCost: 20
healthCost: 0 healthCost: 0
cooldown: 0 cooldown: 2
castableWhileMoving: 0 castableWhileMoving: 0
animationType: 1 animationType: 1
aoePrefab: {fileID: 7332445597516000773, guid: 49d4c037b88cfc54a9fe2d4a84012145, type: 3} aoePrefab: {fileID: 7332445597516000773, guid: 49d4c037b88cfc54a9fe2d4a84012145, type: 3}

View File

@ -22,10 +22,10 @@ MonoBehaviour:
- {fileID: 11400000, guid: 8b74e81cfcd772243b988990f4a8a634, type: 2} - {fileID: 11400000, guid: 8b74e81cfcd772243b988990f4a8a634, type: 2}
abilityEffects: abilityEffects:
- {fileID: 11400000, guid: db121d164df0dac4980d3d5e61327b40, type: 2} - {fileID: 11400000, guid: db121d164df0dac4980d3d5e61327b40, type: 2}
castTime: 1 castTime: 0.75
manaCost: 60 manaCost: 60
healthCost: 0 healthCost: 0
cooldown: 0 cooldown: 3
castableWhileMoving: 0 castableWhileMoving: 0
animationType: 1 animationType: 1
aoePrefab: {fileID: 7535207197812752309, guid: 263ed363454525d46aefa46b653b419d, type: 3} aoePrefab: {fileID: 7535207197812752309, guid: 263ed363454525d46aefa46b653b419d, type: 3}

View File

@ -26,7 +26,7 @@ MonoBehaviour:
castTime: 1 castTime: 1
manaCost: 80 manaCost: 80
healthCost: 0 healthCost: 0
cooldown: 0 cooldown: 3
castableWhileMoving: 0 castableWhileMoving: 0
animationType: 1 animationType: 1
aoePrefab: {fileID: 7455199422598815824, guid: b1f35b67c9e638443a850c78c0f87ac5, type: 3} aoePrefab: {fileID: 7455199422598815824, guid: b1f35b67c9e638443a850c78c0f87ac5, type: 3}

View File

@ -17,6 +17,6 @@ MonoBehaviour:
influencingStats: influencingStats:
- statTag: {fileID: 11400000, guid: 8b74e81cfcd772243b988990f4a8a634, type: 2} - statTag: {fileID: 11400000, guid: 8b74e81cfcd772243b988990f4a8a634, type: 2}
percentInfluence: 0.3 percentInfluence: 0.3
baseValue: 5 baseValue: 2
AlliedTargetMultiplier: 1 AlliedTargetMultiplier: 1
EnemyTargetMultiplier: 1 EnemyTargetMultiplier: 1

View File

@ -52,6 +52,7 @@ public class NetworkedAreaOfEffectOverTime : NetworkedAreaOfEffect
IEnumerator FollowTransform(Transform target) IEnumerator FollowTransform(Transform target)
{ {
endTime = Time.time + duration;
while (Time.time < endTime) while (Time.time < endTime)
{ {
this.transform.position = target.position; this.transform.position = target.position;
@ -110,7 +111,7 @@ public class NetworkedAreaOfEffectOverTime : NetworkedAreaOfEffect
if (target == null) continue; if (target == null) continue;
if (followTarget && !damageFollowingTarget && target == followingTargetTaggable) return; if (followTarget && (!damageFollowingTarget && target == followingTargetTaggable)) continue;
//Debug.Log("hit collider, targetTag: " + target.targetTag.name); //Debug.Log("hit collider, targetTag: " + target.targetTag.name);

View File

@ -119,12 +119,13 @@ public class NetworkedSlash : MonoBehaviour
Debug.Log("hit collider, targetTag: " + target.targetTag.name); Debug.Log("hit collider, targetTag: " + target.targetTag.name);
if (!target.IsValidTarget(ability.targettingTags)) continue;
hitPositionCorrected = target.transform.position; hitPositionCorrected = target.transform.position;
hitPositionCorrected.y = this.transform.position.y; hitPositionCorrected.y = this.transform.position.y;
onTargetHit.Invoke(hitPositionCorrected); onTargetHit.Invoke(hitPositionCorrected);
if (!target.IsValidTarget(ability.targettingTags)) continue;
Debug.Log("hit collider, added target: " + target.name); Debug.Log("hit collider, added target: " + target.name);
targets.Add(target); targets.Add(target);
} }

View File

@ -26,6 +26,7 @@ public class AbilityKeyBinder : MonoBehaviour
Coroutine currentChanneling; Coroutine currentChanneling;
NetworkedChanneling networkedChanneling; NetworkedChanneling networkedChanneling;
AbilityBindInstance abilityBindInstance; AbilityBindInstance abilityBindInstance;
AbilityCooldownTracker cooldownTracker;
bool isDead = false; bool isDead = false;
@ -34,7 +35,7 @@ public class AbilityKeyBinder : MonoBehaviour
user = GetComponentInParent<PhotonView>(); user = GetComponentInParent<PhotonView>();
userTag = GetComponentInParent<Taggable>(); userTag = GetComponentInParent<Taggable>();
mana = GetComponentInParent<Mana>(); mana = GetComponentInParent<Mana>();
cooldownTracker = user.GetComponentInChildren<AbilityCooldownTracker>();
} }
private void Start() private void Start()
@ -72,14 +73,32 @@ public class AbilityKeyBinder : MonoBehaviour
{ {
if (abilityBindInstance != null) if (abilityBindInstance != null)
abilityBindInstance.pressed.SetActive(true); abilityBindInstance.pressed.SetActive(true);
if (mana.EnoughMana(ability.manaCost)) if (IsAbilityOffCooldown() && mana.EnoughMana(ability.manaCost))
{ {
if (ability is ChanneledAbility) 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 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)) if (Input.GetKeyUp(key.keyCode))
@ -111,4 +130,9 @@ public class AbilityKeyBinder : MonoBehaviour
{ {
abilityBindInstance.noMana.SetActive(!mana.EnoughMana(ability.manaCost)); abilityBindInstance.noMana.SetActive(!mana.EnoughMana(ability.manaCost));
} }
public bool IsAbilityOffCooldown()
{
return ability.cooldown <= 0 || !cooldownTracker.OnCooldown(ability);
}
} }

View File

@ -1,3 +1,4 @@
using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
@ -16,16 +17,16 @@ public class PlayerDeathVFX : MonoBehaviour
postProcess = GetComponent<PostProcessVolume>(); postProcess = GetComponent<PostProcessVolume>();
} }
public void BlendIn() public void BlendIn(Action callback = null)
{ {
StopBlendCoroutine(); StopBlendCoroutine();
blendCoroutine = StartCoroutine(BlendWeight(0f, 1f, blendDuration)); blendCoroutine = StartCoroutine(BlendWeight(0f, 1f, blendDuration, callback));
} }
public void BlendOut() public void BlendOut(Action callback = null)
{ {
StopBlendCoroutine(); StopBlendCoroutine();
blendCoroutine = StartCoroutine(BlendWeight(1f, 0f, blendDuration)); blendCoroutine = StartCoroutine(BlendWeight(1f, 0f, blendDuration, callback));
} }
public void ResetWeight() public void ResetWeight()
@ -33,13 +34,13 @@ public class PlayerDeathVFX : MonoBehaviour
postProcess.weight = 0; postProcess.weight = 0;
} }
public void BlendTo(float targetWeight) public void BlendTo(float targetWeight, Action callback = null)
{ {
StopBlendCoroutine(); 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; float elapsedTime = 0f;
@ -52,6 +53,8 @@ public class PlayerDeathVFX : MonoBehaviour
} }
postProcess.weight = endWeight; postProcess.weight = endWeight;
if (callback != null)
callback.Invoke();
} }
private void StopBlendCoroutine() private void StopBlendCoroutine()

View File

@ -1,3 +1,4 @@
using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
@ -74,9 +75,11 @@ public class PlayerDeathVFXManager : MonoBehaviour
} }
private void OnLocalPermaDeath() private void OnLocalPermaDeath()
{ {
cheatedDeathVFX.ResetWeight(); EnablePermaDeathVFX(() =>
faintedVFX.ResetWeight(); {
EnablePermaDeathVFX(); cheatedDeathVFX.ResetWeight();
faintedVFX.ResetWeight();
});
cheatedDeathText.SetActive(false); cheatedDeathText.SetActive(false);
faintedText.SetActive(false); faintedText.SetActive(false);
@ -120,9 +123,9 @@ public class PlayerDeathVFXManager : MonoBehaviour
faintedText.SetActive(false); faintedText.SetActive(false);
} }
public void EnablePermaDeathVFX() public void EnablePermaDeathVFX(Action callback = null)
{ {
permaDeathVFX.BlendIn(); permaDeathVFX.BlendIn(callback);
permaDeathText.SetActive(true); permaDeathText.SetActive(true);
} }
public void DisablePermaDeathVFX() public void DisablePermaDeathVFX()

View File

@ -14,6 +14,7 @@ public class AbilityBindInstance : MonoBehaviour
public Image icon; public Image icon;
public GameObject noMana; public GameObject noMana;
public GameObject pressed; public GameObject pressed;
public Image coolDown;
[Header("Set by Code:")] [Header("Set by Code:")]
public AbilityKeyBinder abilityKeyBinder; public AbilityKeyBinder abilityKeyBinder;
@ -36,7 +37,35 @@ public class AbilityBindInstance : MonoBehaviour
this.icon.sprite = abilityKeyBinder.Ability.Icon; this.icon.sprite = abilityKeyBinder.Ability.Icon;
noMana.SetActive(false); noMana.SetActive(false);
pressed.SetActive(false); pressed.SetActive(false);
coolDown.fillAmount = 1;
coolDown.gameObject.SetActive(false);
abilityKeyBinder.SetupAbilityBindInstance(this); 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);
}
} }

View File

@ -94,7 +94,7 @@ Material:
- _Mode: 0 - _Mode: 0
- _OcclusionStrength: 1 - _OcclusionStrength: 1
- _Parallax: 0.02 - _Parallax: 0.02
- _Rotation: 19.208542 - _Rotation: 6.564019
- _SmoothnessTextureChannel: 0 - _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1 - _SpecularHighlights: 1
- _SrcBlend: 1 - _SrcBlend: 1