You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
1.2 KiB
C#
39 lines
1.2 KiB
C#
1 year ago
|
using System;
|
||
|
|
||
|
namespace Unity.VisualScripting
|
||
|
{
|
||
|
public sealed class ControlConnection : UnitConnection<ControlOutput, ControlInput>, IUnitConnection
|
||
|
{
|
||
|
[Obsolete(Serialization.ConstructorWarning)]
|
||
|
public ControlConnection() : base() { }
|
||
|
|
||
|
public ControlConnection(ControlOutput source, ControlInput destination) : base(source, destination)
|
||
|
{
|
||
|
if (source.hasValidConnection)
|
||
|
{
|
||
|
throw new InvalidConnectionException("Control output ports do not support multiple connections.");
|
||
|
}
|
||
|
}
|
||
|
|
||
|
#region Ports
|
||
|
|
||
|
public override ControlOutput source => sourceUnit.controlOutputs[sourceKey];
|
||
|
|
||
|
public override ControlInput destination => destinationUnit.controlInputs[destinationKey];
|
||
|
|
||
|
IUnitOutputPort IConnection<IUnitOutputPort, IUnitInputPort>.source => source;
|
||
|
|
||
|
IUnitInputPort IConnection<IUnitOutputPort, IUnitInputPort>.destination => destination;
|
||
|
|
||
|
#endregion
|
||
|
|
||
|
#region Dependencies
|
||
|
|
||
|
public override bool sourceExists => sourceUnit.controlOutputs.Contains(sourceKey);
|
||
|
|
||
|
public override bool destinationExists => destinationUnit.controlInputs.Contains(destinationKey);
|
||
|
|
||
|
#endregion
|
||
|
}
|
||
|
}
|