Пример #1
0
 public void DeRegister(ConnectionPoint deregisterConnectionPoint)
 {
     if (startConnectionPoint == deregisterConnectionPoint)
     {
         startConnectionPoint.DeRegisterWire();
         endConnectionPoints.ForEach(tuple => tuple.Item1.DeRegisterWire());
         Destroy(gameObject);
     }
     else
     {
         Destroy(endConnectionPoints.Find(item => item.Item1 == deregisterConnectionPoint).Item2.gameObject);
         endConnectionPoints.RemoveAll(item => item.Item1 == deregisterConnectionPoint);
         deregisterConnectionPoint.DeRegisterWire();
         registeredGates.Remove(deregisterConnectionPoint.logicGate);
         if (registeredGates.Count == 0)
         {
             Destroy(gameObject);
         }
     }
 }