예제 #1
0
    public void ExecuteCommand()
    {
        currentCable = GameObject.Instantiate(GameManager.gm.cablePrefab).GetComponent <Cable>();
        point0.connectedCables.Add(currentCable);
        point1.connectedCables.Add(currentCable);

        if (point0 is PowerCreator)
        {
            (point0 as PowerCreator).dependants.Add(point1 as PowerUser);
        }

        if (point1 is PowerCreator)
        {
            (point1 as PowerCreator).dependants.Add(point0 as PowerUser);
        }

        currentCable.Setup(point0.transform.position, point1.transform.position);
    }
예제 #2
0
    private void Hover()
    {
        if (connecting)
        {
            currentCable.Setup(firstPoint.transform.position, transform.position);
        }

        Structure newHover = GameManager.gm.GetNodeOccupant(transform.position);

        if (newHover != null)
        {
            if (hovering != newHover)
            {
                if (hovering != null)
                {
                    foreach (Cable c in hovering.connectedCables)
                    {
                        c.Hide();
                    }
                }

                foreach (Cable c in newHover.connectedCables)
                {
                    c.Show();
                }

                hovering = newHover;
            }
        }
        else
        {
            if (hovering != null)
            {
                foreach (Cable c in hovering.connectedCables)
                {
                    c.Hide();
                }
            }

            hovering = null;
        }
    }