-
Notifications
You must be signed in to change notification settings - Fork 0
/
champion1.cs
101 lines (91 loc) · 3.07 KB
/
champion1.cs
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
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class Alice : MonoBehaviour
{
public Slider hpSlider;
public Slider mnSlider;
public Text hpText;
public Text mnText;
private Champion champion1;
// Start is called before the first frame update
void Start()
{
champion1 = new Champion
{
name = "Alice",
offensive = new Champion.OffensiveStats
{
ad = 350,
criticalStrike = 100,
},
defensive = new Champion.DefensiveStats
{
hp = 500,
armor = 50,
maxhp = 1000,
death = 0,
},
magic = new Champion.MagicStats
{
mana = 500,
maxmana = 500,
},
niveling = new Champion.NivelingStats
{
exp = 0,
nvl = 1,
hpregen = new Champion.NivelingStats.RegenStats
{
start = 5,
end = 15,
},
armorNvl = new Champion.NivelingStats.RegenStats
{
start = 5,
end = 15,
},
},
status = new Champion.Status
{
gold = 1000,
},
};
UpdateHealthSlider(); // Atualize o Slider com os valores iniciais.
}
// Update is called once per frame
void Update()
{
// Verifique o input e atualize o HP com base nos botões pressionados.
if (Input.GetKeyDown(KeyCode.A))
{
champion1.defensive.hp -= 500;
UpdateHealthSlider();
}
else if (Input.GetKeyDown(KeyCode.F))
{
champion1.defensive.hp += 500;
champion1.magic.mana -= 250;
UpdateHealthSlider();
}
else if (Input.GetKeyDown(KeyCode.S))
{
champion1.defensive.hp -= 150;
UpdateHealthSlider();
};
champion1.defensive.hp += 0.01f;
champion1.magic.mana += 1f;
UpdateHealthSlider();
}
// Função para atualizar o Slider com os valores de hp e maxhp.
private void UpdateHealthSlider()
{
hpSlider.maxValue = champion1.defensive.maxhp;
hpSlider.value = champion1.defensive.hp;
mnSlider.maxValue = champion1.magic.maxmana;
mnSlider.value = champion1.magic.mana;
hpText.text = $"{hpSlider.value:F0}/{hpSlider.maxValue}";
mnText.text = $"{mnSlider.value:F0}/{mnSlider.maxValue}";
}
}