Moved default values away from Start() in AbstractCharacter
This commit is contained in:
parent
5d4c030d9b
commit
f6529e33da
1 changed files with 4 additions and 8 deletions
|
@ -15,22 +15,22 @@ public abstract class AbstractCharacter : MonoBehaviour
|
|||
// Characteristics and status of a character
|
||||
//
|
||||
// Speed in m/s
|
||||
[SerializeField] protected float _maxSpeed;
|
||||
[SerializeField] protected float _maxSpeed = 10;
|
||||
public float MaxSpeed
|
||||
{
|
||||
get { return _maxSpeed; }
|
||||
set { _maxSpeed = value; }
|
||||
}
|
||||
|
||||
[SerializeField] protected int _maxHealth;
|
||||
[SerializeField] protected int _maxHealth = 1;
|
||||
public int MaxHealth => _maxHealth;
|
||||
public int CurrentHealth { get; set; }
|
||||
|
||||
[SerializeField] protected float _maxEnergy;
|
||||
[SerializeField] protected float _maxEnergy = 100;
|
||||
public float MaxEnergy => _maxEnergy;
|
||||
public float CurrentEnergy { get; set; }
|
||||
// Energy gained back per second
|
||||
[SerializeField] private float _energyRegen;
|
||||
[SerializeField] private float _energyRegen = 20;
|
||||
public float EnergyRegen
|
||||
{
|
||||
get { return _energyRegen; }
|
||||
|
@ -44,12 +44,8 @@ public abstract class AbstractCharacter : MonoBehaviour
|
|||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
MaxSpeed = 10;
|
||||
_maxHealth = 1;
|
||||
CurrentHealth = MaxHealth;
|
||||
_maxEnergy = 100;
|
||||
CurrentEnergy = MaxEnergy;
|
||||
EnergyRegen = 20;
|
||||
|
||||
_mover = GetComponentInParent<Mover>();
|
||||
_shooter = GetComponentInParent<AbstractShooter>();
|
||||
|
|
Loading…
Add table
Reference in a new issue