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
602 B
26 lines
602 B
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using Model.Dice.Faces;
|
|
|
|
namespace Model.Dice
|
|
{
|
|
public abstract class AbstractDie<T,G> : RandomnessHaver where T : AbstractDieFace<G>
|
|
{
|
|
public IEnumerable<T> ListFaces => listFaces;
|
|
|
|
private readonly List<T> listFaces = new();
|
|
|
|
protected AbstractDie(params T[] faces)
|
|
{
|
|
listFaces.AddRange(faces);
|
|
}
|
|
|
|
public T GetRandomFace()
|
|
{
|
|
int faceIndex = rnd.Next(0, ListFaces.Count());
|
|
return ListFaces.ElementAt(faceIndex);
|
|
}
|
|
}
|
|
}
|