178 lines
5.8 KiB
C#
178 lines
5.8 KiB
C#
using System.Collections.Generic;
|
||
using System.Linq;
|
||
using UnityEngine;
|
||
|
||
namespace Game
|
||
{
|
||
public interface ICharacter
|
||
{
|
||
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 class Character : ICharacter
|
||
{
|
||
private int _level;
|
||
CharacterConfig _config;
|
||
|
||
public Character(CharacterConfig config)
|
||
{
|
||
this._config = config;
|
||
}
|
||
|
||
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 CharacterConfig Config => _config;
|
||
|
||
// tmp Other
|
||
public float OtherAttackDamage;
|
||
public float OtherArmor;
|
||
|
||
}
|
||
|
||
|
||
/// <summary>
|
||
/// 角色不具备战斗逻辑,所有战斗逻辑由战斗系统完成
|
||
/// 自走棋的角色不具备自动回血功能,只能通过技能buff进行回血
|
||
/// </summary>
|
||
// public interface ICharacter
|
||
// {
|
||
// CharacterConfig Config { get; }
|
||
// GameObject Go { get; }
|
||
//
|
||
// string Name { get; }
|
||
// string Description { get; }
|
||
// int Level { get; }
|
||
// float Hp { get; }
|
||
// float Mp { get; }
|
||
// float Attack { get; }
|
||
// float Defense { get; }
|
||
// float MoveSpeed { get; }
|
||
// float AttackSpeed { get; }
|
||
// bool IsDead { get; }
|
||
//
|
||
// IReadOnlyList<IEquipment> Equipments { get; }
|
||
// IReadOnlyList<Buff> Buffs { get; }
|
||
//
|
||
// bool AddEquipment(IEquipment equipment);
|
||
// bool RemoveAllEquipment(out List<IEquipment> equipments);
|
||
//
|
||
// void OnAttack(Character character);
|
||
// }
|
||
//
|
||
// public class Character : ICharacter
|
||
// {
|
||
// private CharacterConfig _characterConfig;
|
||
// private GameObject _go;
|
||
// private List<IEquipment> _equipments;
|
||
// private string _name;
|
||
// private string _description;
|
||
// private int _level;
|
||
// private float _hp;
|
||
// private float _mp;
|
||
// private float _attack;
|
||
// private float _defense;
|
||
// private float _moveSpeed;
|
||
// private float _attackSpeed;
|
||
//
|
||
// private float tmphp;
|
||
// private float tmpmp;
|
||
// private float tmpattack;
|
||
// private float tmpdefense;
|
||
// private float tmpmoveSpeed;
|
||
// private float tmpattackSpeed;
|
||
// private IReadOnlyList<Buff> _buffs;
|
||
//
|
||
// public CharacterConfig Config => _characterConfig;
|
||
//
|
||
// public GameObject Go => _go;
|
||
//
|
||
// public string Name => _name;
|
||
//
|
||
// public string Description => _description;
|
||
//
|
||
// public int Level => _level;
|
||
//
|
||
// public float Hp => _hp + tmphp;
|
||
//
|
||
// public float Mp => _mp + tmpmp;
|
||
//
|
||
// public float Attack => _attack + tmpattack;
|
||
//
|
||
// public float Defense => _defense + tmpdefense;
|
||
//
|
||
// public float MoveSpeed => _moveSpeed + tmpmoveSpeed;
|
||
//
|
||
// public float AttackSpeed => _attackSpeed + tmpattackSpeed;
|
||
//
|
||
// public bool IsDead => _hp <= 0;
|
||
//
|
||
// public IReadOnlyList<IEquipment> Equipments => _equipments;
|
||
//
|
||
// public IReadOnlyList<Buff> Buffs => _buffs;
|
||
//
|
||
// public Character(CharacterConfig characterConfig, GameObject go)
|
||
// {
|
||
// _characterConfig = characterConfig;
|
||
// _go = go;
|
||
// _name = _characterConfig.BasicStats.Name;
|
||
// _description = _characterConfig.BasicStats.Description;
|
||
// // _hp = _characterConfig.MaxHp;
|
||
// // _mp = _characterConfig.MaxMp;
|
||
// _equipments = new List<IEquipment>();
|
||
// }
|
||
//
|
||
// public bool AddEquipment(IEquipment equipment)
|
||
// {
|
||
// // if (_equipments.Count >= _characterConfig.MaxEquipmentCount)
|
||
// // return false;
|
||
//
|
||
// _equipments.Add(equipment);
|
||
// // tmphp += equipment.Config.Hp;
|
||
// // tmpmp += equipment.Config.Mp;
|
||
// // tmpattack += equipment.Config.Attack;
|
||
// // tmpdefense += equipment.Config.Defense;
|
||
// // tmpmoveSpeed += equipment.Config.MoveSpeed;
|
||
// // tmpattackSpeed += equipment.Config.AttackSpeed;
|
||
// return true;
|
||
// }
|
||
//
|
||
// public bool RemoveAllEquipment(out List<IEquipment> equipments)
|
||
// {
|
||
// equipments = _equipments.ToList();
|
||
// // foreach (var equipment in _equipments)
|
||
// // {
|
||
// // tmphp -= equipment.Config.Hp;
|
||
// // tmpmp -= equipment.Config.Mp;
|
||
// // tmpattack -= equipment.Config.Attack;
|
||
// // tmpdefense -= equipment.Config.Defense;
|
||
// // tmpmoveSpeed -= equipment.Config.MoveSpeed;
|
||
// // tmpattackSpeed -= equipment.Config.AttackSpeed;
|
||
// // }
|
||
//
|
||
// _equipments.Clear();
|
||
// return true;
|
||
// }
|
||
//
|
||
// public void OnAttack(Character target)
|
||
// {
|
||
// foreach (var equipment in _equipments)
|
||
// {
|
||
//
|
||
// }
|
||
// }
|
||
// }
|
||
} |