79 lines
1.8 KiB
C#
79 lines
1.8 KiB
C#
using WaifuCellar.Parts.Base;
|
|
|
|
namespace WaifuCellar.Parts.Human;
|
|
|
|
public sealed class HumanHead(Part? parentPart) : Head {
|
|
public override Part? ParentPart { get; set; } = parentPart;
|
|
private List<Part> _attachedParts = [];
|
|
public override List<Part> AttachedParts => _attachedParts;
|
|
|
|
|
|
public Eye? LeftEye {
|
|
get;
|
|
set {
|
|
_attachedParts.Remove(field!);
|
|
field = value;
|
|
_attachedParts.Add(field!);
|
|
}
|
|
}
|
|
|
|
public Eye? RightEye {
|
|
get;
|
|
set {
|
|
_attachedParts.Remove(field!);
|
|
field = value;
|
|
_attachedParts.Add(field!);
|
|
}
|
|
}
|
|
|
|
public Mouth? Mouth {
|
|
get;
|
|
set {
|
|
_attachedParts.Remove(field!);
|
|
field = value;
|
|
_attachedParts.Add(field!);
|
|
}
|
|
}
|
|
|
|
public void AddPart(Eye eye, EPosition position) {
|
|
if (position == EPosition.Left) {
|
|
LeftEye = eye;
|
|
return;
|
|
}
|
|
|
|
if (position == EPosition.Right) {
|
|
RightEye = eye;
|
|
return;
|
|
}
|
|
}
|
|
|
|
public override void AddPart(Part part) {
|
|
if (part is Eye eye) {
|
|
if (LeftEye == null) {
|
|
LeftEye = eye;
|
|
return;
|
|
}
|
|
|
|
if (RightEye == null) {
|
|
RightEye = eye;
|
|
return;
|
|
}
|
|
}
|
|
|
|
if (part is Mouth mouth) {
|
|
if (Mouth == null) {
|
|
Mouth = mouth;
|
|
return;
|
|
}
|
|
}
|
|
|
|
throw new PartNotAttachableException(part, typeof(HumanHead));
|
|
}
|
|
|
|
public HumanHead(Part? parentPart, Eye? leftEye, Eye? rightEye, Mouth? mouth) : this(parentPart) {
|
|
ParentPart = parentPart;
|
|
LeftEye = leftEye;
|
|
RightEye = rightEye;
|
|
Mouth = mouth;
|
|
}
|
|
} |