ManiaMap.Godot
Procedural generation of metroidvania style maps for Godot .NET.
CollectableGroup.cs
1
using
Godot;
2
using
MPewsey
.ManiaMap.Exceptions;
3
using
System;
4
using
System.Collections.Generic;
5
6
namespace
MPewsey.ManiaMapGodot
7
{
11
[Tool]
12
[GlobalClass]
13
public
partial class
CollectableGroup
: Resource
14
{
18
[Export]
public
string
GroupName
{
get
;
set
; } =
"<None>"
;
19
23
[Export]
public
CollectableGroupEntry
[]
Entries
{
get
;
set
; } = Array.Empty<
CollectableGroupEntry
>();
24
29
public
List<int>
GetCollectableIds
()
30
{
31
var result =
new
List<int>();
32
var
set
=
new
HashSet<int>();
33
34
foreach
(var entry
in
Entries
)
35
{
36
if
(!
set
.Add(entry.Collectable.Id))
37
throw
new
DuplicateIdException($
"Duplicate collectable ID: {entry.Collectable.Id}."
);
38
39
for
(
int
i = 0; i < entry.Quantity; i++)
40
{
41
result.Add(entry.Collectable.Id);
42
}
43
}
44
45
return
result;
46
}
47
}
48
}
MPewsey.ManiaMapGodot.CollectableGroupEntry
An entry in a CollectableGroup.
Definition:
CollectableGroupEntry.cs:11
MPewsey.ManiaMapGodot.CollectableGroup
A collection of collectables and quantities for distribution across associated CollectableSpot2D.
Definition:
CollectableGroup.cs:14
MPewsey.ManiaMapGodot.CollectableGroup.GroupName
string GroupName
The unique group name.
Definition:
CollectableGroup.cs:18
MPewsey.ManiaMapGodot.CollectableGroup.Entries
CollectableGroupEntry[] Entries
An array of entries.
Definition:
CollectableGroup.cs:23
MPewsey.ManiaMapGodot.CollectableGroup.GetCollectableIds
List< int > GetCollectableIds()
Returns a list of collectable ID's in the quantities specified in the group's Entries.
Definition:
CollectableGroup.cs:29
MPewsey.ManiaMapGodot
Definition:
AsyncResourceLoader.cs:6
MPewsey
Definition:
AsyncResourceLoader.cs:6
addons
mpewsey.maniamap
scripts
runtime
CollectableGroup.cs
Generated by
1.9.2