public void PlugTo(IPlugOut port) { if (CanPlug(port)) { if (IsPlugged()) { GetPluggedPort().UnplugFrom(this); } input = (InputAction)port; port.AddPlug(this); } }
//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); } }
public bool CanPlug(IPlugOut plug, bool overwrite = true) { Port port = plug as Port; return((overwrite ? true : !IsPlugged()) && port && port.node != node && port is InputAction); }
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))))); }