diff options
Diffstat (limited to 'WorldlineKeepers/Assets/Scripts/Unit/Characters')
-rw-r--r-- | WorldlineKeepers/Assets/Scripts/Unit/Characters/CharacterInfo.cs | 125 |
1 files changed, 84 insertions, 41 deletions
diff --git a/WorldlineKeepers/Assets/Scripts/Unit/Characters/CharacterInfo.cs b/WorldlineKeepers/Assets/Scripts/Unit/Characters/CharacterInfo.cs index 950b7ae..62dd830 100644 --- a/WorldlineKeepers/Assets/Scripts/Unit/Characters/CharacterInfo.cs +++ b/WorldlineKeepers/Assets/Scripts/Unit/Characters/CharacterInfo.cs @@ -11,43 +11,8 @@ namespace WK public class CharacterStatsCollection { - - } - - public class CharacterBuffsCollection - { - - } - - public class CharacterPerksCollection - { - - } - - /// <summary> - /// 角色当前状态 - /// </summary> - public class CharacterInfo - { - - /// <summary> - /// 角色当前所有属性 - /// </summary> private List<CharacterStats> m_Stats; - - public CharacterStatsCollection stats { get { return m_AllStats; } } - private CharacterStatsCollection m_AllStats; - - /// <summary> - /// 角色当前所有buff - /// </summary> - private List<Buff> m_Buffs; - - /// <summary> - /// 角色当前所有被动 - /// </summary> - private List<PerkBase> m_Perks; - + public List<CharacterStats> stats { get { return m_Stats; } } public CharacterStats this[string statsUID] { get @@ -56,10 +21,9 @@ namespace WK { return null; } - return GetStats(statsUID); + return GetStats(statsUID); } } - public CharacterStats GetStats(string statsUID) { for (int i = 0; i < m_Stats.Count; ++i) @@ -72,7 +36,7 @@ namespace WK return null; } - public bool HasStats(string statsUID) + public bool HasStats(string statsUID) { for (int i = 0; i < m_Stats.Count; ++i) { @@ -83,12 +47,91 @@ namespace WK } return false; } + } + + public class CharacterBuffsCollection + { + private List<Buff> m_Buffs; + public List<Buff> buffs { get { return m_Buffs; } } + + public Buff this[string buffUID] + { + get + { + return GetBuff(buffUID); + } + } - public bool HasBuff(string buffUID) + public Buff GetBuff(string buffUID) { - return false; + if (m_Buffs == null) + return null; + for(int i = 0; i < m_Buffs.Count; ++i) + { + if (m_Buffs[i].uid == buffUID) + { + return m_Buffs[i]; + } + } + return null; + } + + public bool HasBuff(string buffUID) + { + return GetBuff(buffUID) != null; + } + + } + + public class CharacterPerksCollection + { + private List<PerkBase> m_Perks; + public List<PerkBase> perks { get { return m_Perks; } } + + public PerkBase this[string buffUID] + { + get + { + return GetBuff(buffUID); + } + } + + public PerkBase GetBuff(string buffUID) + { + if (m_Perks == null) + return null; + for (int i = 0; i < m_Perks.Count; ++i) + { + if (m_Perks[i].uid == buffUID) + { + return m_Perks[i]; + } + } + return null; } + public bool HasBuff(string buffUID) + { + return GetBuff(buffUID) != null; + } + + } + + /// <summary> + /// 角色当前状态 + /// </summary> + public class CharacterInfo + { + + public CharacterStatsCollection stats { get { return m_Stats; } } + private CharacterStatsCollection m_Stats; + + public CharacterBuffsCollection buffs { get { return m_Buffs; } } + private CharacterBuffsCollection m_Buffs; + + public CharacterPerksCollection perks { get { return m_Perks; } } + public CharacterPerksCollection m_Perks; + } } |