示例#1
0
        public override ConnectionPort CreateNew(Node body)
        {
            FSMOutputNode knob = ScriptableObject.CreateInstance <FSMOutputNode>();

            knob.Init(body, Name, Direction, StyleID, NodeSide, NodeSidePos);
            knob.maxConnectionCount = MaxConnectionCount;
            return(knob);
        }
示例#2
0
        public override bool CanApplyConnection(ConnectionPort port)
        {
            if (port is FSMOutputNode)
            {
                FSMOutputNode valueKnob = port as FSMOutputNode;
                if (valueKnob == null || !valueType.IsAssignableFrom(valueKnob.valueType))
                {
                    return(false);
                }

                if (valueKnob == null || body == valueKnob.body || connections.Contains(valueKnob))
                {
                    return(false);
                }

                if (direction == Direction.None && valueKnob.direction == Direction.None)
                {
                    return(true); // None-Directive connections can always connect
                }
                if (direction == Direction.In && valueKnob.direction != Direction.Out)
                {
                    return(false); // Cannot connect inputs with anything other than outputs
                }
                if (direction == Direction.Out && valueKnob.direction != Direction.In)
                {
                    return(false);              // Cannot connect outputs with anything other than inputs
                }
                if (direction == Direction.Out) // Let inputs handle checks for recursion
                {
                    return(base.CanApplyConnection(this));
                }

                return(true);
            }

            return(false);
        }