Beispiel #1
0
    public void RemoveWire(GUI_HackingWire wireUI)
    {
        //Temporary. We should eventually sync this up with a a unified server/client check for whether someone can remove a wire from the hacking process.
        Pickupable handItem = PlayerManager.LocalPlayerScript.Equipment.ItemStorage.GetActiveHandSlot().Item;

        if (handItem == null || !Validations.HasItemTrait(handItem.gameObject, CommonTraits.Instance.Wirecutter))
        {
            return;
        }

        if (wireUI.StartNode == null || wireUI.EndNode == null)
        {
            return;
        }

        HackingNode outputNode = wireUI.StartNode.HackNode;
        HackingNode inputNode  = wireUI.EndNode.HackNode;

        outputNode.RemoveConnectedNode(inputNode);
        SoundManager.PlayNetworkedAtPos(Wirecut, PlayerManager.LocalPlayerScript.WorldPos);

        //If we're on client, network to the server the changes we made.
        if (!IsServer)
        {
            int   outIndex           = hackNodes.IndexOf(outputNode);
            int   inIndex            = hackNodes.IndexOf(inputNode);
            int[] connectionToRemove = { outIndex, inIndex };
            RemoveHackingConnection.Send(PlayerManager.LocalPlayerScript.gameObject, hackProcess.gameObject, connectionToRemove);
        }

        hackingWires.Remove(wireUI);
        Destroy(wireUI.gameObject);
    }
Beispiel #2
0
    private void UpdateWiresFromConnectionList()
    {
        DeleteOldWires();
        foreach (int[] connection in connectionList)
        {
            if (connection.Length != 2)
            {
                return;
            }

            int outputIndex = connection[0];
            int inputIndex  = connection[1];

            if (hackNodes.ElementAtOrDefault(connection[0]) == null || hackNodes[connection[0]] == null)
            {
                return;
            }
            if (hackNodes.ElementAtOrDefault(connection[1]) == null || hackNodes[connection[1]] == null)
            {
                return;
            }

            GUI_HackingNode outputUINode = GetUIComponentOfNode(hackNodes[outputIndex]);
            GUI_HackingNode inputUINode  = GetUIComponentOfNode(hackNodes[inputIndex]);

            GameObject      connectingWire = Instantiate(connectingWireUIPrefab, transform);
            GUI_HackingWire GUIWire        = connectingWire.GetComponent <GUI_HackingWire>();
            GUIWire.SetStartUINode(outputUINode);
            GUIWire.SetEndUINode(inputUINode);
            GUIWire.PositionWireBody();

            hackingWires.Add(GUIWire);
        }
    }
Beispiel #3
0
    private void GenerateNodeConnections()
    {
        foreach (HackingNode node in outputNodes)
        {
            foreach (HackingNode subNode in node.ConnectedInputNodes)
            {
                GUI_HackingNode outputUINode = GetUIComponentOfNode(node);
                GUI_HackingNode inputUINode  = GetUIComponentOfNode(subNode);

                GameObject      connectingWire = Instantiate(connectingWireUIPrefab, transform);
                GUI_HackingWire GUIWire        = connectingWire.GetComponent <GUI_HackingWire>();
                GUIWire.SetStartUINode(outputUINode);
                GUIWire.SetEndUINode(inputUINode);
                GUIWire.PositionWireBody();

                hackingWires.Add(GUIWire);
            }
        }
    }
    private void UpdateWiresFromConnectionList()
    {
        DeleteOldWires();
        foreach (int[] connection in connectionList)
        {
            int             outputIndex  = connection[0];
            int             inputIndex   = connection[1];
            GUI_HackingNode outputUINode = GetUIComponentOfNode(hackNodes[outputIndex]);
            GUI_HackingNode inputUINode  = GetUIComponentOfNode(hackNodes[inputIndex]);

            GameObject      connectingWire = Instantiate(connectingWireUIPrefab, transform);
            GUI_HackingWire GUIWire        = connectingWire.GetComponent <GUI_HackingWire>();
            GUIWire.SetStartUINode(outputUINode);
            GUIWire.SetEndUINode(inputUINode);
            GUIWire.PositionWireBody();

            hackingWires.Add(GUIWire);
        }
    }