Skip to content

Commit

Permalink
allow power resource amount per tick and percent per tick regen simul…
Browse files Browse the repository at this point in the history
…taneously
  • Loading branch information
michaelday008 committed Jul 11, 2022
1 parent 1400ce2 commit b32e49c
Show file tree
Hide file tree
Showing 8 changed files with 55 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,16 @@ MonoBehaviour:
description: Used by almost everything
useRegionalDescription: 0
resourceDescriptionProfile:
optionalOverride: 0
displayColor: {r: 0, g: 0.7254902, b: 0.09019608, a: 1}
baseAmount: 0
amountPerLevel: 100
tickRate: 1
regenPerTick: 1
regenIsPercent: 1
combatRegenPerTick: 0
amountPerTick: 0
percentPerTick: 1
regenIsPercent: 0
combatAmountPerTick: 0
combatPercentPerTick: 0
combatRegenIsPercent: 0
maximumAmount: 0
isHealth: 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,17 @@ MonoBehaviour:
description: Used by channelers
useRegionalDescription: 0
resourceDescriptionProfile:
optionalOverride: 0
displayColor: {r: 0.38042897, g: 0.47091675, b: 0.9716981, a: 1}
baseAmount: 0
amountPerLevel: 0
tickRate: 1
regenPerTick: 1
regenIsPercent: 1
combatRegenPerTick: 0.5
combatRegenIsPercent: 1
amountPerTick: 0
percentPerTick: 1
regenIsPercent: 0
combatAmountPerTick: 0
combatPercentPerTick: 0.5
combatRegenIsPercent: 0
maximumAmount: 0
isHealth: 0
fillOnReset: 1
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,16 @@ MonoBehaviour:
description: Used by almost everything
useRegionalDescription: 0
resourceDescriptionProfile:
optionalOverride: 0
displayColor: {r: 0, g: 0.7254902, b: 0.09019608, a: 1}
baseAmount: 0
amountPerLevel: 100
tickRate: 1
regenPerTick: 1
regenIsPercent: 1
combatRegenPerTick: 0
amountPerTick: 0
percentPerTick: 1
regenIsPercent: 0
combatAmountPerTick: 0
combatPercentPerTick: 0
combatRegenIsPercent: 0
maximumAmount: 0
isHealth: 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,17 @@ MonoBehaviour:
description: Used by channelers
useRegionalDescription: 0
resourceDescriptionProfile:
optionalOverride: 0
displayColor: {r: 0.38042897, g: 0.47091675, b: 0.9716981, a: 1}
baseAmount: 0
amountPerLevel: 0
tickRate: 1
regenPerTick: 1
regenIsPercent: 1
combatRegenPerTick: 0.5
combatRegenIsPercent: 1
amountPerTick: 0
percentPerTick: 1
regenIsPercent: 0
combatAmountPerTick: 0
combatPercentPerTick: 0.5
combatRegenIsPercent: 0
maximumAmount: 0
isHealth: 0
fillOnReset: 1
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,16 @@ MonoBehaviour:
description: Used by almost everything
useRegionalDescription: 0
resourceDescriptionProfile:
optionalOverride: 0
displayColor: {r: 0, g: 0.7254902, b: 0.09019608, a: 1}
baseAmount: 0
amountPerLevel: 100
tickRate: 1
regenPerTick: 1
regenIsPercent: 1
combatRegenPerTick: 0
amountPerTick: 0
percentPerTick: 1
regenIsPercent: 0
combatAmountPerTick: 0
combatPercentPerTick: 0
combatRegenIsPercent: 0
maximumAmount: 0
isHealth: 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -298,16 +298,10 @@ public void CalculateRegen() {
if (powerResourceRegenDictionary.ContainsKey(powerResource.DisplayName) == false) {
powerResourceRegenDictionary.Add(powerResource.DisplayName, new PowerResourceRegenProperty());
}
if (powerResource.RegenIsPercent == true) {
powerResourceRegenDictionary[powerResource.DisplayName].PercentPerTick += powerResource.RegenPerTick;
} else {
powerResourceRegenDictionary[powerResource.DisplayName].AmountPerTick += powerResource.RegenPerTick;
}
if (powerResource.CombatRegenIsPercent == true) {
powerResourceRegenDictionary[powerResource.DisplayName].CombatPercentPerTick += powerResource.CombatRegenPerTick;
} else {
powerResourceRegenDictionary[powerResource.DisplayName].CombatAmountPerTick += powerResource.CombatRegenPerTick;
}
powerResourceRegenDictionary[powerResource.DisplayName].PercentPerTick += powerResource.PercentPerTick;
powerResourceRegenDictionary[powerResource.DisplayName].AmountPerTick += powerResource.AmountPerTick;
powerResourceRegenDictionary[powerResource.DisplayName].CombatPercentPerTick += powerResource.CombatPercentPerTick;
powerResourceRegenDictionary[powerResource.DisplayName].CombatAmountPerTick += powerResource.CombatAmountPerTick;
}

// loop through all stat providers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,23 @@ public class PowerResource : DescribableResource {
[SerializeField]
private float tickRate = 1f;

[Tooltip("The amount of this resource to regenerate per second while out of combat")]
[Tooltip("The amount of this resource to regenerate per tick while out of combat")]
[FormerlySerializedAs("regenPerTick")]
[SerializeField]
private float regenPerTick = 0f;
private float amountPerTick = 0f;

[Tooltip("If true, the regen per tick is a percentage of the maximum resource amount")]
[Tooltip("The percent of this resource to regenerate per tick while out of combat")]
[SerializeField]
private bool regenIsPercent = false;
private float percentPerTick = 0f;

[Tooltip("The amount of this resource to regenerate per second while in combat")]
[Tooltip("The amount of this resource to regenerate per tick while in combat")]
[FormerlySerializedAs("combatRegenPerTick")]
[SerializeField]
private float combatRegenPerTick = 0f;
private float combatAmountPerTick = 0f;

[Tooltip("If true, the combat regen per tick is a percentage of the maximum resource amount")]
[Tooltip("The percent of this resource to regenerate per tick while in combat")]
[SerializeField]
private bool combatRegenIsPercent = false;
private float combatPercentPerTick = 0f;

[Header("Limits")]

Expand All @@ -70,12 +72,12 @@ public class PowerResource : DescribableResource {


public Color DisplayColor { get => displayColor; set => displayColor = value; }
public float RegenPerTick { get => regenPerTick; set => regenPerTick = value; }
public float CombatRegenPerTick { get => combatRegenPerTick; set => combatRegenPerTick = value; }
public float AmountPerTick { get => amountPerTick; set => amountPerTick = value; }
public float CombatAmountPerTick { get => combatAmountPerTick; set => combatAmountPerTick = value; }
public float PercentPerTick { get => percentPerTick; set => percentPerTick = value; }
public float CombatPercentPerTick { get => combatPercentPerTick; set => combatPercentPerTick = value; }
public float MaximumAmount { get => maximumAmount; set => maximumAmount = value; }
public float TickRate { get => tickRate; set => tickRate = value; }
public bool RegenIsPercent { get => regenIsPercent; set => regenIsPercent = value; }
public bool CombatRegenIsPercent { get => combatRegenIsPercent; set => combatRegenIsPercent = value; }
public bool IsHealth { get => isHealth; set => isHealth = value; }
public bool FillOnReset { get => fillOnReset; set => fillOnReset = value; }
public float BaseAmount { get => baseAmount; set => baseAmount = value; }
Expand Down
2 changes: 1 addition & 1 deletion ProjectSettings/ProjectSettings.asset
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ PlayerSettings:
16:10: 1
16:9: 1
Others: 1
bundleVersion: 0.14.3a
bundleVersion: 0.14.4a
preloadedAssets: []
metroInputSource: 0
wsaTransparentSwapchain: 0
Expand Down

0 comments on commit b32e49c

Please sign in to comment.