summaryrefslogtreecommitdiff
path: root/WorldlineKeepers/Assets/Scripts/Unit/Characters/CharacterInfo.cs
blob: 63bf35f8bb8b2c3bdebc478ca3a51c4322ffa726 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
using JetBrains.Annotations;
using System.Collections;
using System.Collections.Generic;
using Unity.VisualScripting;
using UnityEngine;
using WK.Data;
using WK;

namespace WK
{

    public class CharacterStatsCollection
    {
        private List<CharacterStats> m_Stats;
        public List<CharacterStats> stats { get { return m_Stats; } }
        public CharacterStats this[string statsUID]
        {
            get
            {
                if (m_Stats == null)
                {
                    return null;
                }
                return GetStats(statsUID);
            }
        }
        public CharacterStats GetStats(string statsUID)
        {
            for (int i = 0; i < m_Stats.Count; ++i)
            {
                if (m_Stats[i].uid == statsUID)
                {
                    return m_Stats[i];
                }
            }
            return null;
        }

        public bool HasStats(string statsUID)
        {
            for (int i = 0; i < m_Stats.Count; ++i)
            {
                if (m_Stats[i].uid == statsUID)
                {
                    return true;
                }
            }
            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 Buff GetBuff(string buffUID)
        {
            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>
    /// 角色当前状态,包括: 属性数值、buff、perk
    /// </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;

        public void OnUpdate()
        {

        }

    }

}