Ejemplo n.º 1
0
    // Methods

    public void CreatePuzzle(Puzzle puzzle)
    {
        m_Puzzle = puzzle;

        puzzle.addNode        += AddNode;
        puzzle.removeNode     += RemoveNode;
        puzzle.addEdge        += AddEdge;
        puzzle.removeEdge     += RemoveEdge;
        puzzle.addElement     += AddElement;
        puzzle.removeElement  += RemoveElement;
        puzzle.addItem        += AddItem;
        puzzle.removeItem     += RemoveItem;
        puzzle.addReceiver    += AddReceiver;
        puzzle.removeReceiver += RemoveReceiver;

        if (s_TempDragEdge)
        {
            Destroy(s_TempDragEdge.gameObject);
        }
        s_TempDragEdge = Instantiate(edgePrefab) as EdgeFront;
        s_TempDragEdge.Set(this, null);
        s_TempDragEdge.gameObject.SetActive(false);
        s_TempDragEdge.transform.parent = transform;

        if (s_TempDragNode)
        {
            Destroy(s_TempDragNode.gameObject);
        }
        s_TempDragNode = Instantiate(nodePrefab) as NodeFront;
        s_TempDragNode.Set(this, null);
        s_TempDragNode.gameObject.SetActive(false);
        s_TempDragNode.transform.parent = transform;

        s_TempDragReceiver = new PuzzleGate();
    }
Ejemplo n.º 2
0
    public void AddEdge(PuzzleEdge edge)
    {
        EdgeFront edgeFront = Instantiate(edgePrefab) as EdgeFront;

        edgeFront.transform.parent = transform;
        edgeFront.gameObject.name  = "Edge " + edge.nodeA.name + " - " + edge.nodeB.name;
        edgeFront.Set(this, edge);
        edges.Add(edgeFront);
    }