You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
640 B
26 lines
640 B
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using Model.Dice.Faces;
|
|
|
|
namespace Model.Dice
|
|
{
|
|
public abstract class AbstractDie<T> : RandomnessHaver
|
|
{
|
|
public IEnumerable<AbstractDieFace<T>> ListFaces => listFaces;
|
|
|
|
private readonly List<AbstractDieFace<T>> listFaces = new();
|
|
|
|
protected AbstractDie(params AbstractDieFace<T>[] faces)
|
|
{
|
|
listFaces.AddRange(faces);
|
|
}
|
|
|
|
public AbstractDieFace<T> GetRandomFace()
|
|
{
|
|
int faceIndex = rnd.Next(0, ListFaces.Count());
|
|
return ListFaces.ElementAt(faceIndex);
|
|
}
|
|
}
|
|
}
|