-
Notifications
You must be signed in to change notification settings - Fork 0
/
DicePad.cs
41 lines (33 loc) · 983 Bytes
/
DicePad.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
using Godot;
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
public partial class DicePad : Node2D
{
private IList<Dice> _dice = new List<Dice>();
public IList<Dice> DiceList => _dice;
public (int[] instanceCounts, bool utopzeeFound) GetInstanceCounts()
{
int[] instanceCounts = new int[(int)DiceValue.Six];
bool utopzeeFound = false;
foreach(Dice die in _dice)
{
instanceCounts[die.Frame]++;
}
utopzeeFound = instanceCounts.Contains(5);
return (instanceCounts, utopzeeFound);
}
// Called when the node enters the scene tree for the first time.
public override void _Ready()
{
for (int i = 1; i <= Constants.NumberOfDice; i++)
{
_dice.Add(GetNode<Dice>("Die" + i));
}
}
// Called every frame. 'delta' is the elapsed time since the previous frame.
public override void _Process(double delta)
{
}
}