63 lines
1.9 KiB
C#
63 lines
1.9 KiB
C#
|
using System.Collections.Generic;
|
|||
|
using System.Linq;
|
|||
|
using UnityEngine;
|
|||
|
|
|||
|
namespace Game
|
|||
|
{
|
|||
|
public interface IHero
|
|||
|
{
|
|||
|
public int AttackDamage { get; }
|
|||
|
public float AttackSpeed { get; }
|
|||
|
public int Mana { get; }
|
|||
|
public int StartingMana { get; }
|
|||
|
public int AttackRange { get; }
|
|||
|
public int CriticalHitChance { get; }
|
|||
|
public int Armor { get; }
|
|||
|
public int MagicResistance { get; }
|
|||
|
|
|||
|
public bool AddEquipment(Equipment equipment);
|
|||
|
public bool RemoveAllEquipment();
|
|||
|
}
|
|||
|
|
|||
|
public class Hero : IHero
|
|||
|
{
|
|||
|
private int _level;
|
|||
|
HeroConfig _config;
|
|||
|
List<Equipment> _equipments;
|
|||
|
|
|||
|
public Hero(HeroConfig config)
|
|||
|
{
|
|||
|
this._config = config;
|
|||
|
_equipments = new List<Equipment>();
|
|||
|
}
|
|||
|
|
|||
|
public bool IsDeath;
|
|||
|
public int AttackDamage => _config.BasicStats.AttackDamage[_level];
|
|||
|
public float AttackSpeed => _config.BasicStats.AttackSpeed[_level];
|
|||
|
public int Mana => _config.BasicStats.Mana[_level];
|
|||
|
public int StartingMana => _config.BasicStats.StartingMana[_level];
|
|||
|
public int AttackRange => _config.BasicStats.AttackRange[_level];
|
|||
|
public int CriticalHitChance => _config.BasicStats.CriticalHitChance[_level];
|
|||
|
public int Armor => _config.BasicStats.Armor[_level];
|
|||
|
public int MagicResistance => _config.BasicStats.MagicResistance[_level];
|
|||
|
|
|||
|
public bool AddEquipment(Equipment equipment)
|
|||
|
{
|
|||
|
if (_equipments.Count >= _config.BasicStats.MaxEquipmentCount)
|
|||
|
return false;
|
|||
|
_equipments.Add(equipment);
|
|||
|
return true;
|
|||
|
}
|
|||
|
|
|||
|
public bool RemoveAllEquipment()
|
|||
|
{
|
|||
|
throw new System.NotImplementedException();
|
|||
|
}
|
|||
|
|
|||
|
public HeroConfig Config => _config;
|
|||
|
|
|||
|
// tmp Other
|
|||
|
public float OtherAttackDamage;
|
|||
|
public float OtherArmor;
|
|||
|
}
|
|||
|
}
|