mirror of
https://github.com/coding-horror/basic-computer-games.git
synced 2026-01-03 16:48:04 -08:00
23 lines
538 B
C#
23 lines
538 B
C#
using BugGame.Resources;
|
|
|
|
namespace BugGame.Parts;
|
|
|
|
internal class Head : ParentPart
|
|
{
|
|
private Feelers _feelers = new();
|
|
|
|
public Head()
|
|
: base(Message.HeadAdded, Message.HeadNotNeeded)
|
|
{
|
|
}
|
|
|
|
public override bool IsComplete => _feelers.IsComplete;
|
|
|
|
protected override bool TryAddCore(IPart part, out Message message)
|
|
=> part switch
|
|
{
|
|
Feeler => _feelers.TryAddOne(out message),
|
|
_ => throw new NotSupportedException($"Can't add a {part.Name} to a {Name}.")
|
|
};
|
|
}
|