-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPlayer_Stats.cs
More file actions
149 lines (124 loc) · 3.94 KB
/
Copy pathPlayer_Stats.cs
File metadata and controls
149 lines (124 loc) · 3.94 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
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
143
144
145
146
147
148
149
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
public class Player_Stats : MonoBehaviour {
public GameObject player;
public int healthMax; //max health of player
public int health; //current health of player
public int manaMax; //max mana of player
public int mana; //current mana of player
public int exp; //current experience of player
public int expNext; //experience needed for next level
public int level; //current level
public int attackdam; //current attack power
public status playerCondition = status.FINE; //current condition
public Button startgame;
public string playername = null;
public string ability1 = null;
public string ability2 = null;
public string ability3 = null;
public string ability4 = null;
public string[] abilityList;
public string[] activeabilities;
public string playerChoice = " ";
public bool levelCheck = false;
public bool combatready = false;
void Awake ()
{
DontDestroyOnLoad(transform.gameObject);
}
// Update is called once per frame
void Update () {
player = GameObject.FindGameObjectWithTag("Player");
if (health > healthMax)
{
health = healthMax;
}
if (mana > manaMax)
{
mana = manaMax;
}
if (levelCheck == true)
{
if (exp >= expNext)
{
levelup();
AbilityCheck();
expCalc();
}
}
}
void levelup()
{
level++;
healthMax += (100 * level);
health = healthMax;
manaMax += (20 * level);
mana = manaMax;
attackdam += (10 *level);
levelCheck = false;
}
public void playerLocation()
{
this.transform.position = player.transform.position;
Debug.Log(player.transform.position);
}
void expCalc()
{
expNext += (int)(exp * 1.5f);
}
void AbilityCheck()
{
if (playerChoice == "Animations/Warrior/Warrior")
{
if (level == 2)
ability1 = activeabilities[0] = abilityList[0];
else if (level == 4)
ability2 = activeabilities[1] = abilityList[1];
else if (level == 7)
ability3 = activeabilities[2] = abilityList[2];
else if (level == 10)
ability4 = activeabilities[3] = abilityList[3];
}
if (playerChoice == "Animations/Healer/Healer")
{
if (level == 2)
ability1 = activeabilities[0] = abilityList[8];
else if (level == 4)
ability2 = activeabilities[1] = abilityList[9];
else if (level == 7)
ability3 = activeabilities[2] = abilityList[10];
else if (level == 10)
ability4 = activeabilities[3] = abilityList[11];
}
if (playerChoice == "Animations/Fighter/Fighter")
{
if (level == 2)
ability1 = activeabilities[0] = abilityList[4];
else if (level == 4)
ability2 = activeabilities[1] = abilityList[5];
else if (level == 7)
ability3 = activeabilities[2] = abilityList[6];
else if (level == 10)
ability4 = activeabilities[3] = abilityList[7];
}
}
public void ClassWarrior()
{
startgame.interactable = true;
playerChoice = "Animations/Warrior/Warrior";
ability1 = activeabilities[0] = abilityList[0];
}
public void ClassHealer()
{
startgame.interactable = true;
playerChoice = "Animations/Healer/Healer";
ability1 = activeabilities[0] = abilityList[8];
}
public void ClassFighter()
{
startgame.interactable = true;
playerChoice = "Animations/Fighter/Fighter";
ability1 = activeabilities[0] = abilityList[4];
}
}