Exemple #1
0
    private void FixedUpdate()
    {
        ElementNode nodeToInteractWith = ElementNode.GetNearestNode(transform.position, interactRange, true);

        if (nodeToInteractWith)
        {
            WithinInteractRange    = !nodeToInteractWith.trackedElemental.dontLetInteract;
            RequiredInteractButton = nodeToInteractWith.trackedElemental.InteractButton;

            if (redElement)
            {
                if (redElement.InteractButton != "")
                {
                    if (Input.GetButtonDown(redElement.InteractButton))
                    {
                        redElement.DoInteract(nodeToInteractWith);
                    }
                }
            }

            if (blueElement)
            {
                if (blueElement.InteractButton != "")
                {
                    if (Input.GetButtonDown(blueElement.InteractButton))
                    {
                        blueElement.DoInteract(nodeToInteractWith);
                    }
                }
            }

            if (greenElement)
            {
                if (greenElement.InteractButton != "")
                {
                    if (Input.GetButtonDown(greenElement.InteractButton))
                    {
                        greenElement.DoInteract(nodeToInteractWith);
                    }
                }
            }
        }
        else
        {
            WithinInteractRange    = false;
            RequiredInteractButton = "";
        }
    }