예제 #1
0
        public Component TryToConnect(Component target)
        {
            ConnectionInterfacePool    belongsPool      = belongs.GetModel().ConnectionInterfacePool;
            ConnectionInterfacePool    targetPool       = target.GetModel().ConnectionInterfacePool;
            List <ConnectionInterface> commonInterfaces = belongsPool.FindSameInterfaces(targetPool);

            foreach (var commonInterface in commonInterfaces)
            {
                Component connected = TryToConnect(target, commonInterface);
                if (connected != null)
                {
                    return(connected);
                }
            }
            return(null);
        }
예제 #2
0
 protected ComponentModel(string name, List <ConnectionInterface> connectionInterfaces, float mass)
 {
     this.name = name;
     this.mass = mass;
     connectionInterfacePool = new ConnectionInterfacePool(connectionInterfaces);
 }