internal void RemoveDevice() { if (this.Device == null) { return; } this.Device = null; }
public static string GetDeviceTexture(CryptDevice device) { return(device.Match( hellFireReceiver: _ => "Receiver", soulReceiver: _ => "Receiver", pipe: _ => "HellFirePipe", cryptCoinEngine: _ => "Engine" )); }
public void PlaceCryptDevice(CryptDevice cryptDevice, Point position) { if (!CanPlaceCryptDevice(cryptDevice, position)) { throw new Exception("check CanPlaceCryptDevice first"); } var features = cryptDevice.GetFeaturesThisWouldOccupyAtPosition(this, position); foreach (var feature in features) { feature.PlaceDevice(cryptDevice); } _devices.Add(cryptDevice); }
public bool CanPlaceCryptDevice(CryptDevice cryptDevice, Point position) { var features = cryptDevice.GetFeaturesThisWouldOccupyAtPosition(this, position); if (features.Any(f => f is CryptFeature.Void || f is CryptFeature.HardRock || f is CryptFeature.SoftRock || f.Device != null )) { return(false); } return(cryptDevice.Match( hellFireReceiver: _ => features.All(f => f is CryptFeature.HellFireSpire), soulReceiver: _ => features.All(f => f is CryptFeature.SoulSpire), pipe: _ => features.All(f => f is CryptFeature.Floor), cryptCoinEngine: _ => features.All(f => f is CryptFeature.Floor) )); }
public void PlaceDevice(CryptDevice device) { device.SetHostFeature(this); this.Device = device; }