ManiaMap.Unity
Procedural generation of metroidvania style maps for Unity.
CollectableGroup Class Reference

A class for creating groups of CollectableResource. More...

Inheritance diagram for CollectableGroup:

Public Member Functions

bool AddCollectable (CollectableResource collectable)
 Adds the collectable to the group if it is valid and doesn't already exist. Returns true if it is added. More...
 
bool ContainsCollectable (CollectableResource collectable)
 Returns true if the group contains the collectable. More...
 
List< int > GetCollectableIds ()
 Returns a list of collectable ID's in the quantity specified by the entries. More...
 

Properties

List< CollectableGroupEntryCollectables [getset]
 A list of collectables. More...
 
string Name [getset]
 The group name. More...
 

Private Attributes

List< CollectableGroupEntry_collectables = new List<CollectableGroupEntry>()
 
string _name = "<None>"
 

Detailed Description

A class for creating groups of CollectableResource.

The following are some design patterns to consider when implementing collectables so that they may be referenced by this class:

  1. If the collectables in your project are Scriptable Object and have low memory usage, simply have your collectables inherit from the CollectableResource class. The objects themselves may then be be directly added to the CollectableGroup.
  2. If the collectables in your project are other object types or have large memory usage, create CollectableResource Scriptable Objects in your project that will serve as the collectable unique ID's. Reference these collectables in your objects (so that the ID's are synced), as well as add the CollectableResource Scriptable Objects to the CollectableGroup.

Definition at line 20 of file CollectableGroup.cs.

Member Function Documentation

◆ AddCollectable()

bool AddCollectable ( CollectableResource  collectable)

Adds the collectable to the group if it is valid and doesn't already exist. Returns true if it is added.

Parameters
collectableThe collectable.

Definition at line 59 of file CollectableGroup.cs.

◆ ContainsCollectable()

bool ContainsCollectable ( CollectableResource  collectable)

Returns true if the group contains the collectable.

Parameters
collectableThe collectable.

Definition at line 74 of file CollectableGroup.cs.

◆ GetCollectableIds()

List< int > GetCollectableIds ( )

Returns a list of collectable ID's in the quantity specified by the entries.

Definition at line 39 of file CollectableGroup.cs.

Member Data Documentation

◆ _collectables

List<CollectableGroupEntry> _collectables = new List<CollectableGroupEntry>()
private

Definition at line 30 of file CollectableGroup.cs.

◆ _name

string _name = "<None>"
private

Definition at line 23 of file CollectableGroup.cs.

Property Documentation

◆ Collectables

List<CollectableGroupEntry> Collectables
getset

A list of collectables.

Definition at line 34 of file CollectableGroup.cs.

◆ Name

string Name
getset

The group name.

Definition at line 27 of file CollectableGroup.cs.


The documentation for this class was generated from the following file: