refactor: Consolidate skill component logic into SkillComponentBase and update manager access to singletons.
This commit is contained in:
@@ -5,26 +5,27 @@ using Mr.BrickAdventures.scripts.Resources;
|
||||
namespace Mr.BrickAdventures.scripts.components;
|
||||
|
||||
[GlobalClass]
|
||||
public partial class BrickArmorSkillComponent : Node, ISkill
|
||||
public partial class BrickArmorSkillComponent : SkillComponentBase
|
||||
{
|
||||
private HealthComponent _healthComponent;
|
||||
private SkillData _skillData;
|
||||
private float _armorBonus = 0;
|
||||
|
||||
public void Initialize(Node owner, SkillData data)
|
||||
|
||||
public override void Initialize(Node owner, SkillData data)
|
||||
{
|
||||
if (owner is not PlayerController player) return;
|
||||
_healthComponent = player.GetNode<HealthComponent>("HealthComponent");
|
||||
_skillData = data;
|
||||
base.Initialize(owner, data);
|
||||
if (Player != null)
|
||||
{
|
||||
_healthComponent = Player.GetNode<HealthComponent>("HealthComponent");
|
||||
}
|
||||
}
|
||||
|
||||
public void Activate()
|
||||
public override void Activate()
|
||||
{
|
||||
if (_healthComponent == null || _skillData == null) return;
|
||||
ApplyUpgrade(_skillData.Upgrades[_skillData.Level - 1]);
|
||||
if (_healthComponent == null || Data == null) return;
|
||||
ApplyUpgrade(Data.Upgrades[Data.Level - 1]);
|
||||
}
|
||||
|
||||
public void Deactivate()
|
||||
public override void Deactivate()
|
||||
{
|
||||
if (_healthComponent == null) return;
|
||||
_healthComponent.MaxHealth -= _armorBonus;
|
||||
@@ -35,7 +36,7 @@ public partial class BrickArmorSkillComponent : Node, ISkill
|
||||
_armorBonus = 0;
|
||||
}
|
||||
|
||||
public void ApplyUpgrade(SkillUpgrade upgrade)
|
||||
public override void ApplyUpgrade(SkillUpgrade upgrade)
|
||||
{
|
||||
if (_healthComponent == null || upgrade == null) return;
|
||||
|
||||
|
||||
@@ -7,41 +7,33 @@ using Mr.BrickAdventures.scripts.Resources;
|
||||
namespace Mr.BrickAdventures.scripts.components;
|
||||
|
||||
[GlobalClass]
|
||||
public partial class BrickShieldSkillComponent : Node, ISkill
|
||||
public partial class BrickShieldSkillComponent : SkillComponentBase
|
||||
{
|
||||
[Export] public PackedScene ShieldScene { get; set; }
|
||||
|
||||
private PlayerController _player;
|
||||
private Node2D _shieldInstance;
|
||||
private SkillData _skillData;
|
||||
private GameManager _gameManager;
|
||||
private SkillManager _skillManager;
|
||||
private HealthComponent _shieldHealth;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
_gameManager = GetNode<GameManager>(Constants.GameManagerPath);
|
||||
_skillManager = GetNode<SkillManager>(Constants.SkillManagerPath);
|
||||
_gameManager = GameManager.Instance;
|
||||
_skillManager = SkillManager.Instance;
|
||||
}
|
||||
|
||||
public void Initialize(Node owner, SkillData data)
|
||||
public override void Activate()
|
||||
{
|
||||
_player = owner as PlayerController;
|
||||
_skillData = data;
|
||||
}
|
||||
|
||||
public void Activate()
|
||||
{
|
||||
if (_player == null || ShieldScene == null || _shieldInstance != null) return;
|
||||
if (Player == null || ShieldScene == null || _shieldInstance != null) return;
|
||||
|
||||
_shieldInstance = ShieldScene.Instantiate<Node2D>();
|
||||
_player.AddChild(_shieldInstance);
|
||||
Player.AddChild(_shieldInstance);
|
||||
_shieldInstance.Position = Vector2.Zero;
|
||||
_shieldInstance.TreeExiting += OnShieldDestroyed;
|
||||
_shieldHealth = _shieldInstance.GetNode<HealthComponent>("HealthComponent");
|
||||
}
|
||||
|
||||
public void Deactivate()
|
||||
public override void Deactivate()
|
||||
{
|
||||
if (_shieldInstance != null && IsInstanceValid(_shieldInstance))
|
||||
{
|
||||
@@ -51,7 +43,7 @@ public partial class BrickShieldSkillComponent : Node, ISkill
|
||||
_shieldInstance = null;
|
||||
}
|
||||
|
||||
public void ApplyUpgrade(SkillUpgrade upgrade)
|
||||
public override void ApplyUpgrade(SkillUpgrade upgrade)
|
||||
{
|
||||
upgrade.Properties.TryGetValue("shield_health", out var newHealth);
|
||||
if (_shieldHealth != null)
|
||||
@@ -63,10 +55,10 @@ public partial class BrickShieldSkillComponent : Node, ISkill
|
||||
|
||||
private void OnShieldDestroyed()
|
||||
{
|
||||
if (_gameManager != null && _skillData != null && _skillManager != null)
|
||||
if (_gameManager != null && Data != null && _skillManager != null)
|
||||
{
|
||||
_gameManager.RemoveSkill(_skillData.Name);
|
||||
_skillManager.RemoveSkill(_skillData.Name);
|
||||
_gameManager.RemoveSkill(Data.Name);
|
||||
_skillManager.RemoveSkill(Data.Name);
|
||||
}
|
||||
_shieldInstance = null;
|
||||
}
|
||||
|
||||
@@ -5,16 +5,14 @@ using Mr.BrickAdventures.scripts.Resources;
|
||||
namespace Mr.BrickAdventures.scripts.components;
|
||||
|
||||
[GlobalClass]
|
||||
public partial class BrickThrowComponent : Node, ISkill
|
||||
public partial class BrickThrowComponent : SkillComponentBase
|
||||
{
|
||||
[Export] public PackedScene BrickScene { get; set; }
|
||||
[Export] public float FireRate { get; set; } = 1.0f;
|
||||
[Export] public PlayerController PlayerController { get; set; }
|
||||
[Export] public ThrowInputResource ThrowInputBehavior { get; set; }
|
||||
|
||||
|
||||
private bool _canThrow = true;
|
||||
private Timer _timer;
|
||||
private SkillData _skillData;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
@@ -59,60 +57,54 @@ public partial class BrickThrowComponent : Node, ISkill
|
||||
|
||||
private void ThrowBrick(float powerMultiplier = 1f)
|
||||
{
|
||||
if (!_canThrow || PlayerController == null || BrickScene == null)
|
||||
if (!_canThrow || Player == null || BrickScene == null)
|
||||
return;
|
||||
|
||||
var instance = BrickScene.Instantiate<Node2D>();
|
||||
var init = instance.GetNodeOrNull<ProjectileInitComponent>("ProjectileInitComponent");
|
||||
|
||||
|
||||
if (init != null)
|
||||
{
|
||||
var @params = new ProjectileInitParams()
|
||||
{
|
||||
Position = PlayerController.GlobalPosition,
|
||||
Rotation = PlayerController.Rotation,
|
||||
Direction = PlayerController.LastDirection,
|
||||
Position = Player.GlobalPosition,
|
||||
Rotation = Player.Rotation,
|
||||
Direction = Player.LastDirection,
|
||||
PowerMultiplier = powerMultiplier,
|
||||
};
|
||||
|
||||
|
||||
init.Initialize(@params);
|
||||
}
|
||||
|
||||
|
||||
GetTree().CurrentScene.AddChild(instance);
|
||||
_canThrow = false;
|
||||
_timer.Start();
|
||||
}
|
||||
|
||||
public void Initialize(Node owner, SkillData data)
|
||||
public override void Initialize(Node owner, SkillData data)
|
||||
{
|
||||
PlayerController = owner as PlayerController;
|
||||
_skillData = data;
|
||||
base.Initialize(owner, data);
|
||||
|
||||
ThrowInputBehavior = (ThrowInputResource)ThrowInputBehavior?.Duplicate();
|
||||
|
||||
if (PlayerController == null)
|
||||
if (Data.Level > 0 && Data.Upgrades.Count >= Data.Level)
|
||||
{
|
||||
GD.PushError("BrickThrowComponent: Owner is not a PlayerController.");
|
||||
}
|
||||
|
||||
if (_skillData.Level > 0 && _skillData.Upgrades.Count >= _skillData.Level)
|
||||
{
|
||||
ApplyUpgrade(_skillData.Upgrades[_skillData.Level - 1]);
|
||||
ApplyUpgrade(Data.Upgrades[Data.Level - 1]);
|
||||
}
|
||||
}
|
||||
|
||||
public void Activate()
|
||||
public override void Activate()
|
||||
{
|
||||
if (ThrowInputBehavior != null) ThrowInputBehavior.ThrowRequested += ThrowBrick;
|
||||
SetProcessInput(true);
|
||||
}
|
||||
|
||||
public void Deactivate()
|
||||
public override void Deactivate()
|
||||
{
|
||||
if (ThrowInputBehavior != null) ThrowInputBehavior.ThrowRequested -= ThrowBrick;
|
||||
}
|
||||
|
||||
public void ApplyUpgrade(SkillUpgrade upgrade)
|
||||
public override void ApplyUpgrade(SkillUpgrade upgrade)
|
||||
{
|
||||
foreach (var property in upgrade.Properties)
|
||||
{
|
||||
|
||||
@@ -6,40 +6,25 @@ using Mr.BrickAdventures.scripts.Resources;
|
||||
namespace Mr.BrickAdventures.scripts.components;
|
||||
|
||||
[GlobalClass]
|
||||
public partial class DoubleJumpSkillComponent : Node, ISkill
|
||||
public partial class DoubleJumpSkillComponent : SkillComponentBase
|
||||
{
|
||||
[Export] private PackedScene _doubleJumpAbilityScene;
|
||||
private PlayerController _playerController;
|
||||
|
||||
public void Initialize(Node owner, SkillData data)
|
||||
{
|
||||
_playerController = owner as PlayerController;
|
||||
if (_playerController == null)
|
||||
{
|
||||
GD.PrintErr("DoubleJumpSkillComponent must be a child of a PlayerController.");
|
||||
}
|
||||
}
|
||||
|
||||
public void Activate()
|
||||
public override void Activate()
|
||||
{
|
||||
if (_playerController == null) return;
|
||||
if (Player == null) return;
|
||||
|
||||
var hasAbility = _playerController.GetActiveAbilities().Any(ability => ability is DoubleJumpAbility);
|
||||
var hasAbility = Player.GetActiveAbilities().Any(ability => ability is DoubleJumpAbility);
|
||||
|
||||
if (!hasAbility)
|
||||
{
|
||||
var abilityInstance = _doubleJumpAbilityScene.Instantiate<DoubleJumpAbility>();
|
||||
_playerController.AddAbility(abilityInstance);
|
||||
Player.AddAbility(abilityInstance);
|
||||
}
|
||||
}
|
||||
|
||||
public void Deactivate()
|
||||
public override void Deactivate()
|
||||
{
|
||||
_playerController?.RemoveAbility<DoubleJumpAbility>();
|
||||
}
|
||||
|
||||
public void ApplyUpgrade(SkillUpgrade upgrade)
|
||||
{
|
||||
|
||||
Player?.RemoveAbility<DoubleJumpAbility>();
|
||||
}
|
||||
}
|
||||
@@ -22,7 +22,7 @@ public partial class ExitDoorComponent : Area2D, IUnlockable
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
_gameManager = GetNode<GameManager>(Constants.GameManagerPath);
|
||||
_gameManager = GameManager.Instance;
|
||||
_achievementManager = GetNode<AchievementManager>(Constants.AchievementManagerPath);
|
||||
|
||||
BodyEntered += OnExitAreaBodyEntered;
|
||||
|
||||
@@ -5,62 +5,59 @@ using Mr.BrickAdventures.scripts.Resources;
|
||||
namespace Mr.BrickAdventures.scripts.components;
|
||||
|
||||
[GlobalClass]
|
||||
public partial class GroundPoundSkillComponent : Node, ISkill
|
||||
public partial class GroundPoundSkillComponent : SkillComponentBase
|
||||
{
|
||||
[Export] public float PoundForce { get; set; } = 1200f;
|
||||
[Export] public PackedScene ShockwaveScene { get; set; }
|
||||
|
||||
private PlayerController _player;
|
||||
|
||||
private PlayerInputHandler _input;
|
||||
private bool _isPounding = false;
|
||||
|
||||
public void Initialize(Node owner, SkillData data)
|
||||
|
||||
public override void Initialize(Node owner, SkillData data)
|
||||
{
|
||||
_player = owner as PlayerController;
|
||||
if (_player != null)
|
||||
base.Initialize(owner, data);
|
||||
if (Player != null)
|
||||
{
|
||||
_input = _player.GetNode<PlayerInputHandler>("PlayerInputHandler");
|
||||
_input = Player.GetNode<PlayerInputHandler>("PlayerInputHandler");
|
||||
}
|
||||
}
|
||||
|
||||
public override void _PhysicsProcess(double delta)
|
||||
{
|
||||
if (_player == null || _input == null)
|
||||
if (Player == null || _input == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Check if we just landed from a ground pound to create the shockwave.
|
||||
if (_isPounding && _player.IsOnFloor())
|
||||
if (_isPounding && Player.IsOnFloor())
|
||||
{
|
||||
_isPounding = false;
|
||||
if (ShockwaveScene != null)
|
||||
{
|
||||
var shockwave = ShockwaveScene.Instantiate<Node2D>();
|
||||
_player.GetParent()?.AddChild(shockwave);
|
||||
shockwave.GlobalPosition = _player.GlobalPosition;
|
||||
Player.GetParent()?.AddChild(shockwave);
|
||||
shockwave.GlobalPosition = Player.GlobalPosition;
|
||||
}
|
||||
}
|
||||
|
||||
// Check to initiate a ground pound. The player must be in the air.
|
||||
if (_input.DownHeld && !_player.IsOnFloor() && !_isPounding)
|
||||
if (_input.DownHeld && !Player.IsOnFloor() && !_isPounding)
|
||||
{
|
||||
// Apply a strong downward force, zeroing out horizontal movement.
|
||||
_player.Velocity = new Vector2(0, PoundForce);
|
||||
Player.Velocity = new Vector2(0, PoundForce);
|
||||
_isPounding = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void Activate()
|
||||
|
||||
public override void Activate()
|
||||
{
|
||||
SetPhysicsProcess(true);
|
||||
}
|
||||
|
||||
public void Deactivate()
|
||||
|
||||
public override void Deactivate()
|
||||
{
|
||||
SetPhysicsProcess(false);
|
||||
_isPounding = false;
|
||||
}
|
||||
|
||||
public void ApplyUpgrade(SkillUpgrade upgrade) { }
|
||||
}
|
||||
@@ -7,14 +7,12 @@ using Mr.BrickAdventures.scripts.Resources;
|
||||
namespace Mr.BrickAdventures.scripts.components;
|
||||
|
||||
[GlobalClass]
|
||||
public partial class MagneticSkillComponent : Node, ISkill
|
||||
public partial class MagneticSkillComponent : SkillComponentBase
|
||||
{
|
||||
[Export] public Area2D MagneticArea { get; set; }
|
||||
[Export] public float MagneticMoveDuration { get; set; } = 1.25f;
|
||||
|
||||
private Array<Node2D> _collectablesToPickUp = [];
|
||||
private Node2D _owner;
|
||||
private SkillData _skillData;
|
||||
|
||||
public override void _Process(double delta)
|
||||
{
|
||||
@@ -25,11 +23,11 @@ public partial class MagneticSkillComponent : Node, ISkill
|
||||
_collectablesToPickUp.Remove(collectable);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
MoveCollectableToOwner(collectable);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void OnBodyEntered(Node2D body)
|
||||
{
|
||||
if (!HasComponentInChildren(body, "CollectableComponent")) return;
|
||||
@@ -37,11 +35,11 @@ public partial class MagneticSkillComponent : Node, ISkill
|
||||
if (_collectablesToPickUp.Contains(body)) return;
|
||||
_collectablesToPickUp.Add(body);
|
||||
}
|
||||
|
||||
|
||||
private void OnAreaEntered(Area2D area)
|
||||
{
|
||||
if (!HasComponentInChildren(area, "CollectableComponent")) return;
|
||||
|
||||
|
||||
if (_collectablesToPickUp.Contains(area)) return;
|
||||
_collectablesToPickUp.Add(area);
|
||||
}
|
||||
@@ -49,7 +47,7 @@ public partial class MagneticSkillComponent : Node, ISkill
|
||||
private bool HasComponentInChildren(Node node, string componentName)
|
||||
{
|
||||
if (node == null) return false;
|
||||
|
||||
|
||||
if (node.HasNode(componentName)) return true;
|
||||
|
||||
foreach (var child in node.GetChildren())
|
||||
@@ -59,28 +57,27 @@ public partial class MagneticSkillComponent : Node, ISkill
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private void MoveCollectableToOwner(Node2D collectable)
|
||||
{
|
||||
if (!IsInstanceValid(collectable) || !IsInstanceValid(_owner)) return;
|
||||
|
||||
var direction = (_owner.GlobalPosition - collectable.GlobalPosition).Normalized();
|
||||
if (!IsInstanceValid(collectable) || !IsInstanceValid(Player)) return;
|
||||
|
||||
var direction = (Player.GlobalPosition - collectable.GlobalPosition).Normalized();
|
||||
var speed = direction.Length() / MagneticMoveDuration;
|
||||
|
||||
collectable.GlobalPosition += direction.Normalized() * speed;
|
||||
}
|
||||
|
||||
public void Initialize(Node owner, SkillData data)
|
||||
public override void Initialize(Node owner, SkillData data)
|
||||
{
|
||||
_owner = owner as Node2D;
|
||||
_skillData = data;
|
||||
|
||||
if (_owner == null)
|
||||
base.Initialize(owner, data);
|
||||
|
||||
if (Player == null)
|
||||
{
|
||||
GD.PushWarning("MagneticSkillComponent: Owner is not a Node2D.");
|
||||
GD.PushWarning("MagneticSkillComponent: Owner is not a Player/Node2D.");
|
||||
}
|
||||
|
||||
if (MagneticArea == null)
|
||||
@@ -96,34 +93,34 @@ public partial class MagneticSkillComponent : Node, ISkill
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (_skillData.Level > 0 && _skillData.Upgrades.Count >= _skillData.Level)
|
||||
|
||||
if (Data.Level > 0 && Data.Upgrades.Count >= Data.Level)
|
||||
{
|
||||
ApplyUpgrade(_skillData.Upgrades[_skillData.Level - 1]);
|
||||
ApplyUpgrade(Data.Upgrades[Data.Level - 1]);
|
||||
}
|
||||
}
|
||||
|
||||
public void Activate()
|
||||
public override void Activate()
|
||||
{
|
||||
if (MagneticArea == null)
|
||||
{
|
||||
GD.PushError("MagneticSkillComponent: MagneticArea is not set.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
MagneticArea.BodyEntered += OnBodyEntered;
|
||||
MagneticArea.AreaEntered += OnAreaEntered;
|
||||
}
|
||||
|
||||
public void Deactivate()
|
||||
public override void Deactivate()
|
||||
{
|
||||
if (MagneticArea == null) return;
|
||||
|
||||
|
||||
MagneticArea.BodyEntered -= OnBodyEntered;
|
||||
MagneticArea.AreaEntered -= OnAreaEntered;
|
||||
}
|
||||
|
||||
public void ApplyUpgrade(SkillUpgrade upgrade)
|
||||
public override void ApplyUpgrade(SkillUpgrade upgrade)
|
||||
{
|
||||
foreach (var property in upgrade.Properties)
|
||||
{
|
||||
|
||||
@@ -16,7 +16,7 @@ public partial class PlayerDeathComponent : Node2D
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
_gameManager = GetNode<GameManager>(Constants.GameManagerPath);
|
||||
_gameManager = GameManager.Instance;
|
||||
HealthComponent.Death += OnDeath;
|
||||
}
|
||||
|
||||
|
||||
29
scripts/components/SkillComponentBase.cs
Normal file
29
scripts/components/SkillComponentBase.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using Godot;
|
||||
using Mr.BrickAdventures.scripts.interfaces;
|
||||
using Mr.BrickAdventures.scripts.Resources;
|
||||
|
||||
namespace Mr.BrickAdventures.scripts.components;
|
||||
|
||||
/// <summary>
|
||||
/// Base class for all skill components to reduce boilerplate.
|
||||
/// </summary>
|
||||
public abstract partial class SkillComponentBase : Node, ISkill
|
||||
{
|
||||
protected PlayerController Player { get; private set; }
|
||||
protected SkillData Data { get; private set; }
|
||||
|
||||
public virtual void Initialize(Node owner, SkillData data)
|
||||
{
|
||||
Player = owner as PlayerController;
|
||||
Data = data;
|
||||
|
||||
if (Player == null)
|
||||
{
|
||||
GD.PrintErr($"{GetType().Name} must be a child of a PlayerController.");
|
||||
}
|
||||
}
|
||||
|
||||
public abstract void Activate();
|
||||
public abstract void Deactivate();
|
||||
public virtual void ApplyUpgrade(SkillUpgrade upgrade) { }
|
||||
}
|
||||
1
scripts/components/SkillComponentBase.cs.uid
Normal file
1
scripts/components/SkillComponentBase.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://dvuevrf5vr5jk
|
||||
@@ -20,8 +20,8 @@ public partial class SkillUnlockerComponent : Node
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
_gameManager = GetNode<GameManager>(Constants.GameManagerPath);
|
||||
SkillManager = GetNode<SkillManager>(Constants.SkillManagerPath);
|
||||
_gameManager = GameManager.Instance;
|
||||
SkillManager = SkillManager.Instance;
|
||||
}
|
||||
|
||||
private bool HasEnoughCoins(int amount)
|
||||
@@ -36,7 +36,6 @@ public partial class SkillUnlockerComponent : Node
|
||||
if (!HasEnoughCoins(skill.Upgrades[0].Cost)) return false;
|
||||
|
||||
skill.Level = 1;
|
||||
skill.IsActive = true;
|
||||
_gameManager.RemoveCoins(skill.Upgrades[0].Cost);
|
||||
|
||||
// Add to session state via GameStateStore
|
||||
|
||||
@@ -5,18 +5,19 @@ using Mr.BrickAdventures.scripts.Resources;
|
||||
namespace Mr.BrickAdventures.scripts.components;
|
||||
|
||||
[GlobalClass]
|
||||
public partial class XRayVisionSkillComponent : Node, ISkill
|
||||
public partial class XRayVisionSkillComponent : SkillComponentBase
|
||||
{
|
||||
[Export(PropertyHint.Layers2DRender)] public uint SecretLayer { get; set; }
|
||||
[Export] public float Duration { get; set; } = 5.0f;
|
||||
|
||||
|
||||
private Camera2D _camera;
|
||||
private Viewport _viewport;
|
||||
private uint _originalVisibilityLayer;
|
||||
private Timer _timer;
|
||||
|
||||
public void Initialize(Node owner, SkillData data)
|
||||
|
||||
public override void Initialize(Node owner, SkillData data)
|
||||
{
|
||||
base.Initialize(owner, data);
|
||||
_viewport = GetViewport();
|
||||
_camera = GetViewport().GetCamera2D();
|
||||
_timer = new Timer { OneShot = true };
|
||||
@@ -24,16 +25,16 @@ public partial class XRayVisionSkillComponent : Node, ISkill
|
||||
_timer.Timeout += Deactivate;
|
||||
}
|
||||
|
||||
public void Activate()
|
||||
public override void Activate()
|
||||
{
|
||||
if (_camera == null) return;
|
||||
|
||||
|
||||
_originalVisibilityLayer = _camera.VisibilityLayer;
|
||||
_camera.VisibilityLayer |= SecretLayer;
|
||||
_timer.Start(Duration);
|
||||
}
|
||||
|
||||
public void Deactivate()
|
||||
public override void Deactivate()
|
||||
{
|
||||
if (_camera != null)
|
||||
{
|
||||
@@ -41,7 +42,7 @@ public partial class XRayVisionSkillComponent : Node, ISkill
|
||||
}
|
||||
}
|
||||
|
||||
public void ApplyUpgrade(SkillUpgrade upgrade)
|
||||
public override void ApplyUpgrade(SkillUpgrade upgrade)
|
||||
{
|
||||
if (upgrade.Properties.TryGetValue("duration", out var newDuration))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user