updating mana through cues
This commit is contained in:
@@ -433,8 +433,7 @@ public partial class PlayerController : CharacterBody3D,
|
||||
var baseTags = new TagContainer(
|
||||
forgeManager.TagsManager,
|
||||
[
|
||||
Tag.RequestTag(forgeManager.TagsManager, "character.player"),
|
||||
Tag.RequestTag(forgeManager.TagsManager, "class.warrior")
|
||||
Tag.RequestTag(forgeManager.TagsManager, "character.player")
|
||||
]);
|
||||
|
||||
Attributes = new EntityAttributes(new PlayerAttributeSet());
|
||||
@@ -445,7 +444,7 @@ public partial class PlayerController : CharacterBody3D,
|
||||
|
||||
var empoweredActionData = new AbilityData(
|
||||
name: "Empowered Action",
|
||||
costEffect: EmpoweredAction.CostEffect(),
|
||||
costEffect: EmpoweredAction.CostEffect(forgeManager.TagsManager),
|
||||
cooldownEffects: [EmpoweredAction.CooldownEffect(forgeManager.TagsManager)],
|
||||
instancingPolicy: AbilityInstancingPolicy.PerEntity,
|
||||
behaviorFactory: () => new EmpoweredActionBehavior());
|
||||
@@ -457,7 +456,7 @@ public partial class PlayerController : CharacterBody3D,
|
||||
levelOverridePolicy: LevelComparison.None,
|
||||
sourceEntity: this);
|
||||
|
||||
var manaRegenEffect = new Effect(ManaRegen.ManaRegen(), new EffectOwnership(this, this));
|
||||
var manaRegenEffect = new Effect(ManaRegen.ManaRegen(forgeManager.TagsManager), new EffectOwnership(this, this));
|
||||
_manaRegenEffectHandle = EffectsManager.ApplyEffect(manaRegenEffect);
|
||||
|
||||
var health = Attributes["PlayerAttributeSet.Health"].CurrentValue; // 100
|
||||
@@ -529,7 +528,7 @@ public partial class PlayerController : CharacterBody3D,
|
||||
}
|
||||
if (RKnockback != null) CKnockback!.RKnockback = RKnockback;
|
||||
|
||||
PlayerUi.Initialize(CHealth.CurrentHealth);
|
||||
PlayerUi.Initialize(CHealth.CurrentHealth, Attributes["PlayerAttributeSet.Mana"].BaseValue);
|
||||
CDamageable.DamageTaken += (damageable, record) => ReduceHealth(damageable, record);
|
||||
CDamageable.DamageTaken += (_, record) => RegisterKnockback(new KnockbackRecord(record));
|
||||
CHealth.HealthChanged += PlayerUi.OnHealthChanged;
|
||||
@@ -765,7 +764,7 @@ public partial class PlayerController : CharacterBody3D,
|
||||
{
|
||||
RHealth.StartingHealth = newHealthValue;
|
||||
CHealth!.CurrentHealth = newHealthValue;
|
||||
PlayerUi.Initialize(CHealth.CurrentHealth);
|
||||
PlayerUi.Initialize(CHealth.CurrentHealth, Attributes["PlayerAttributeSet.Mana"].BaseValue);
|
||||
}
|
||||
public void SetPlayerDamageOverride(float newDamageValue)
|
||||
{
|
||||
@@ -2309,7 +2308,7 @@ public partial class PlayerController : CharacterBody3D,
|
||||
HandleEnemyTargeting();
|
||||
}
|
||||
|
||||
private float _oldMana = 100;
|
||||
// private float _oldMana = 100;
|
||||
public override void _Process(double delta)
|
||||
{
|
||||
// Manage head and camera movement
|
||||
@@ -2317,10 +2316,10 @@ public partial class PlayerController : CharacterBody3D,
|
||||
|
||||
EffectsManager.UpdateEffects(delta);
|
||||
// TODO: change for actual Cue
|
||||
var currentMana = Attributes["PlayerAttributeSet.Mana"].CurrentValue;
|
||||
if (Mathf.Abs(currentMana - _oldMana) > Mathf.Epsilon)
|
||||
PlayerUi.OnManaChanged(currentMana);
|
||||
_oldMana = currentMana;
|
||||
// var currentMana = Attributes["PlayerAttributeSet.Mana"].CurrentValue;
|
||||
// if (Mathf.Abs(currentMana - _oldMana) > Mathf.Epsilon)
|
||||
// PlayerUi.OnManaChanged(currentMana);
|
||||
// _oldMana = currentMana;
|
||||
}
|
||||
|
||||
///////////////////////////
|
||||
|
||||
Reference in New Issue
Block a user