예제 #1
0
    public virtual void MoveBegin()
    {
        currentEdge = Instantiate(edgePrefab).GetComponent <NewEdge>();
        edges.Add(currentEdge);
        currentEdge.SetStartTarget(this);
        currentEdge.SetEndTarget(GameObject.Find("Controller").transform);

        //Ordering
        SpriteRenderer edgePointRenderer = GetComponentInChildren <SpriteRenderer>();
        string         sortingLayerName  = edgePointRenderer.sortingLayerName;
        int            sortingOrder      = edgePointRenderer.sortingOrder;

        currentEdge.SetOrdering(sortingLayerName, sortingOrder);
    }
예제 #2
0
    public virtual void CreateEdge(Transform targetTr)
    {
        currentEdge = Instantiate(edgePrefab).GetComponent <NewEdge>();
        if (EdgeManager.instance.registerEdge(currentEdge, targetTr, transform))
        {
            IInputParam <T> targetInputModule = targetTr.GetComponent <IInputParam <T> >();
            edges.Add(currentEdge);
            connectedInputModules.Add(targetInputModule);
            currentEdge.SetStartTarget(this);
            currentEdge.SetEndTarget(targetTr);

            //Ordering
            SpriteRenderer edgePointRenderer = GetComponentInChildren <SpriteRenderer>();
            string         sortingLayerName  = edgePointRenderer.sortingLayerName;
            int            sortingOrder      = edgePointRenderer.sortingOrder;
            currentEdge.SetOrdering(sortingLayerName, sortingOrder);
        }
        else
        {
            Debug.LogWarning("Edge Register Failed : " + name + " -> " + targetTr.gameObject.name);
            Destroy(currentEdge.gameObject);
        }
    }