Ejemplo n.º 1
0
 internal void RemoveDevice()
 {
     if (this.Device == null)
     {
         return;
     }
     this.Device = null;
 }
Ejemplo n.º 2
0
 public static string GetDeviceTexture(CryptDevice device)
 {
     return(device.Match(
                hellFireReceiver: _ => "Receiver",
                soulReceiver: _ => "Receiver",
                pipe: _ => "HellFirePipe",
                cryptCoinEngine: _ => "Engine"
                ));
 }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
        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)
                       ));
        }
Ejemplo n.º 5
0
 public void PlaceDevice(CryptDevice device)
 {
     device.SetHostFeature(this);
     this.Device = device;
 }