Exemplo n.º 1
0
    public bool DropToConnector(BlueprintEntityPin oppositionPin)
    {
        var connector = BlueprintConnector.current;

        // if having a same pin type at two head, remove them.
        if (pinType == BlueprintEntityPinType.In)
        {
            if (connector.b != null)
            {
                Destroy(connector.gameObject);
                BlueprintConnector.current = null;
                return(false);
            }
            connector.SetEntityB(entity, this);
        }
        else
        {
            if (connector.a != null)
            {
                Destroy(connector.gameObject);
                BlueprintConnector.current = null;
                return(false);
            }
            connector.SetEntityA(entity, this);
        }
        // create block connector
        var blockConnector = connector.CreateBlockConnector();

        if (dropToConnectorCallback != null)
        {
            dropToConnectorCallback.Invoke(blockConnector);
        }
        if (oppositionPin.dropToConnectorCallback != null)
        {
            oppositionPin.dropToConnectorCallback.Invoke(blockConnector);
        }
        Debug.Log(blockConnector.a);
        Debug.Log(blockConnector.b);
        oppositionPin.blueprintConnector
              = blueprintConnector
              = connector;
        BlueprintConnector.current = null;
        return(true);
    }
Exemplo n.º 2
0
 void Start()
 {
     _parentTransform = transform.parent.parent;
     _connectorPrefab = Resources.Load <BlueprintConnector>(connectorResPath);
     _pinImage        = GetComponent <Image>();
 }