Exemplo n.º 1
0
    public void setActive(bool active)
    {
        isActiveNode = active;
        ship.SetActive(active);

        // Tell ObjectManager if I'm the new active node
        if (active)
        {
            ObjectManager.Instance.currentActiveNode = this;
        }

        // Game over, so don't do any game logic
        if (TimeCounter.Instance.gameOver)
        {
            return;
        }

        // Enable/disable the adjacent nodes as clickable
        NodeConnections myNodeConnections = GetComponent <NodeConnections>();

        if (myNodeConnections != null)
        {
            foreach (var node in myNodeConnections.connectedNodes.Keys)
            {
                ActiveNode nodeScript = node.GetComponent <ActiveNode>();
                if (nodeScript != null)
                {
                    nodeScript.setRingActive(isActiveNode);
                }
            }
        }
    }