/// <summary> /// Cleanly switches the PoE of the entity. /// </summary> public void SwitchPoE(IPlaneOfExistence newPoe) { if (newPoe == null) { throw new ArgumentNullException(nameof(newPoe)); } if (newPoe == PoE) { return; } var oldPoe = PoE; PoE?.RemoveEntity(this); PoE = newPoe; PoE.RegisterNewEntity(this); Parent.SendMessage(new PoeSwitchMessage(oldPoe, newPoe)); UpdateRegion(); }
public Region([NotNull] IPlaneOfExistence poe, int x, int y) { Poe = poe ?? throw new ArgumentNullException(nameof(poe)); X = x; Y = y; }
public PoeSwitchMessage([CanBeNull] IPlaneOfExistence oldPoe, [NotNull] IPlaneOfExistence newPoe) { OldPoe = oldPoe; NewPoe = newPoe ?? throw new ArgumentNullException(nameof(newPoe)); }