-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCharacterData.cs
More file actions
96 lines (80 loc) · 1.91 KB
/
CharacterData.cs
File metadata and controls
96 lines (80 loc) · 1.91 KB
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
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CharacterData : MonoBehaviour
{
[SerializeField] internal List<GameCharactor> _data;//DocId´Â ³»ºÎ¿¡ Á¸Àç _data;
private static CharacterData _ins;
public List<CharEquipZone> viewData;
static public CharacterData GetSGT()
{
return _ins;
}
public void InitData()
{
if (_ins == null)
{
_ins = this;
for (int i = 0; i < _data.Count; i++)
{
_data[i].equipData[0] = UnityEngine.Random.Range(0, 5);
}
}
}
public GameCharactor GetCharData(int _value)
{
return _ins._data[_value];
}
public void Event_SpendItem(int _value)
{
if (_ins == null)
return;
if (_ins.viewData[_value] == null)
return;
_ins.viewData[_value].RefreshText();
}
}
[Serializable]
public class Charactor
{
public string charName;
public float maxHp;
public float hp;
public float ability;
public float resist;
public float speed;
public int[] equipData= new int[10];
public void setCharactor(string _charName, int _hp, int _attackPower)
{
charName = _charName;
hp = _hp;
ability = _attackPower;
}
public bool IsAlive()
{
return hp > 0;
}
}
[Serializable]
public class GameCharactor : Charactor
{
public string jobId;
public int index;
public void setGameCharactor(string _charName, string _jobId, int _hp, int _attackPower, int _index)
{
setCharactor(_charName, _hp, _attackPower);
jobId = _jobId;
index = _index;
}
public void InteractFood()
{
// TODO : Detail interact with food
maxHp += 2;
hp += 1;
}
public void SetRandomFace()
{
// TODO : Reroll OutFace
}
}