forked from McChew/Root-TTS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlizardboard.ttslua
87 lines (80 loc) · 1.93 KB
/
lizardboard.ttslua
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
mice = 0
bunnies = 0
foxes = 0
wait_id = 0
function onLoad(save_state)
createButtons()
wait_id = Wait.time(updateButtons, 1, -1)
end
function onDestroy()
Wait.stop(wait_id)
end
function nothing()
end
function addCard(suit)
suit = suit:lower()
if suit == "fox" then
foxes = foxes +1
elseif suit == "mouse" then
mice = mice + 1
elseif suit == "bunny" then
bunnies= bunnies + 1
end
end
function createButtons()
self.createButton({
click_function = "nothing",
function_owner = self,
label = '0',
position = {0.7, 0.1, -0.17},
scale = {0.5, 0.5, 0.5},
width = 0,
height = 0,
font_size = 120
})
self.createButton({
click_function = "nothing",
function_owner = self,
label = '0',
position = {0.9, 0.1, -0.17},
scale = {0.5, 0.5, 0.5},
width = 0,
height = 0,
font_size = 120
})
self.createButton({
click_function = "nothing",
function_owner = self,
label = '0',
position = {1.09, 0.1, -0.17},
scale = {0.5, 0.5, 0.5},
width = 0,
height = 0,
font_size = 120
})
end
function updateButtons()
mice = 0
foxes = 0
bunnies = 0
items = Physics.cast({
origin = self.positionToWorld({-0.90, 0.2, 0.55}),
direction = self.getTransformUp(),
type = 3,
size = {3, 0.1, 6},
max_distance = 2,
})
for _, item in ipairs(items) do
if item.hit_object.tag == "Card" then
addCard(item.hit_object.getDescription())
end
if item.hit_object.tag == "Deck" then
for _, card in ipairs(item.hit_object.getObjects()) do
addCard(card.description)
end
end
end
self.editButton({index=0,label=tostring(mice)})
self.editButton({index=1,label=tostring(bunnies)})
self.editButton({index=2,label=tostring(foxes)})
end