Пример #1
0
 public void PlugTo(IPlugOut port)
 {
     if (CanPlug(port))
     {
         if (IsPlugged())
         {
             GetPluggedPort().UnplugFrom(this);
         }
         input = (InputAction)port;
         port.AddPlug(this);
     }
 }
Пример #2
0
 //Input -> Component
 //Output -> Rigidbody
 public void PlugTo(IPlugOut port)
 {
     if (CanPlug(port))
     {
         if (IsPlugged())
         {
             GetPluggedPort().UnplugFrom(this);
         }
         plugged_port = (IOutputValue)port;
         if (typeof(T).IsAssignableFrom(((IOutputValue)port).valueType))
         {
             get_filter = GetFilter.Action;
         }
         else if (((IOutputValue)port).valueType.CanConvert(typeof(T)))
         {
             get_filter = GetFilter.ActionWithConverter;
         }
         port.AddPlug(this);
     }
 }
Пример #3
0
        public bool CanPlug(IPlugOut plug, bool overwrite = true)
        {
            Port port = plug as Port;

            return((overwrite ? true : !IsPlugged()) && port && port.node != node && port is InputAction);
        }
Пример #4
0
        public bool CanPlug(IPlugOut plug, bool overwrite = true)
        {
            Port port = plug as Port;

            return(this.display_port && ((overwrite & (port && port.display_port) ? true : !IsPlugged()) && port && port.display_port && port.node != node && port is IOutputValue && (typeof(T).IsAssignableFrom(((IOutputValue)port).valueType) || ((IOutputValue)port).valueType.CanConvert(typeof(T)))));
        }