more stuff
This commit is contained in:
@@ -2,11 +2,13 @@ using System;
|
||||
using Godot;
|
||||
using NodeWar;
|
||||
using NodeWar.Scripts;
|
||||
using NodeWar.scripts.components;
|
||||
|
||||
public partial class Base : Area2D
|
||||
{
|
||||
private ProgressBar _progressBar;
|
||||
private ProgressBar _healthBar;
|
||||
public HealthComponent HealthComponent;
|
||||
|
||||
private Node2D _selection;
|
||||
private Node2D _gfx;
|
||||
|
||||
@@ -16,12 +18,6 @@ public partial class Base : Area2D
|
||||
[Export]
|
||||
public Faction Faction = Faction.Neutral;
|
||||
|
||||
[Export]
|
||||
public float Health { get; set; } = 50;
|
||||
|
||||
[Export]
|
||||
public float MaxHealth { get; set; } = 50;
|
||||
|
||||
private float _buildSpeed = 28;
|
||||
private float _buildProgress = 0;
|
||||
private float _maxBuildProgress = 100;
|
||||
@@ -34,15 +30,15 @@ public partial class Base : Area2D
|
||||
MouseEntered += OnMouseEntered;
|
||||
MouseExited += OnMouseExited;
|
||||
|
||||
_healthBar = GetNode<ProgressBar>("HealthBar");
|
||||
HealthComponent = GetNode<HealthComponent>("HealthComponent");
|
||||
_progressBar = GetNode<ProgressBar>("ProgressBar");
|
||||
_selection = GetNode<Node2D>("Selection");
|
||||
_gfx = GetNode<Node2D>("Gfx");
|
||||
|
||||
_selection.Visible = false;
|
||||
_progressBar.MaxValue = _maxBuildProgress;
|
||||
_healthBar.MaxValue = MaxHealth;
|
||||
_healthBar.Value = Health;
|
||||
HealthComponent.MaxHealth = 100;
|
||||
HealthComponent.Health = 100;
|
||||
|
||||
UpdateColor();
|
||||
}
|
||||
@@ -59,6 +55,7 @@ public partial class Base : Area2D
|
||||
var pip = _pipScene.Instantiate<Pip>();
|
||||
|
||||
GetParent().AddChild(pip);
|
||||
pip.Faction = Faction;
|
||||
pip.GlobalPosition = GlobalPosition;
|
||||
pip.Target = GetTree().GetFirstNodeInGroup("enemyBase") as Base;
|
||||
}
|
||||
@@ -88,7 +85,6 @@ public partial class Base : Area2D
|
||||
private void UpdateProgressBars()
|
||||
{
|
||||
_progressBar.Value = _buildProgress;
|
||||
_healthBar.Value = Health;
|
||||
}
|
||||
|
||||
private void OnMouseExited()
|
||||
|
||||
Reference in New Issue
Block a user