public virtual void OnDispose() { if (Behaviour != null) { Behaviour.Dispose(); } if (AssignedTo != null) { ObstacleData AssignedObstacle = (ObstacleData)AssignedTo; if (AssignedObstacle != null) { AssignedObstacle.AssignedCards.Remove(this); } } }