Пример #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();
    }
Пример #2
0
    // Callbacks

    public void AddNode(PuzzleNode node)
    {
        NodeFront nodeFront = Instantiate(nodePrefab) as NodeFront;

        nodeFront.transform.parent = transform;
        nodeFront.gameObject.name  = "Node " + node.name;
        nodeFront.Set(this, node);
        nodes.Add(nodeFront);
    }