예제 #1
0
        public Segment ConnectPower()
        {
            if (Primitives.Any(p => p.Marker == _cfg.LeftPower))
            {
                var leftC = Connectors
                            .FirstOrDefault(p => p.Marker == _cfg.LeftConnector);
                if (leftC != null)
                {
                    leftC.ConnectedTo.Add(_cfg.LeftPower);
                }
            }

            if (Primitives.Any(p => p.Marker == _cfg.RightPower))
            {
                var leftC = Connectors
                            .FirstOrDefault(p => p.Marker == _cfg.RightConnector);
                if (leftC != null)
                {
                    leftC.ConnectedTo.Add(_cfg.RightPower);
                }
            }

            return(this);
        }