예제 #1
0
 internal void RemoveDevice()
 {
     if (this.Device == null)
     {
         return;
     }
     this.Device = null;
 }
예제 #2
0
파일: Functions.cs 프로젝트: srakowski/LD44
 public static string GetDeviceTexture(CryptDevice device)
 {
     return(device.Match(
                hellFireReceiver: _ => "Receiver",
                soulReceiver: _ => "Receiver",
                pipe: _ => "HellFirePipe",
                cryptCoinEngine: _ => "Engine"
                ));
 }
예제 #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);
        }
예제 #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)
                       ));
        }
예제 #5
0
 public void PlaceDevice(CryptDevice device)
 {
     device.SetHostFeature(this);
     this.Device = device;
 }