Esempio n. 1
0
    public void SetEnabled(bool enabled)
    {
        if (objectToEnable != null)
        {
            objectToEnable.SetActive(enabled);

            if (enabled)
            {
                SetButtonColor(activeColor);

                if (mutuallyExclusive)
                {
                    activeButton = this;
                }
            }
            else
            {
                SetButtonColor(inactiveColor);

                if (objectToEnable.GetComponent <DrawableObject>())
                {
                    foreach (LineRenderer child in objectToEnable.GetComponentsInChildren <LineRenderer>())
                    {
                        GameObject.Destroy(child.gameObject);
                    }
                }
            }
        }
    }
Esempio n. 2
0
    public void ToggleObject()
    {
        if (objectToEnable != null)
        {
            if (!objectToEnable.activeSelf && activeButton != this)
            {
                if (activeButton != null && mutuallyExclusive)
                {
                    activeButton.SetEnabled(false);
                    activeButton = this;
                }
            }
            else if (objectToEnable.activeSelf && mutuallyExclusive)
            {
                activeButton = null;
            }

            SetEnabled(!objectToEnable.activeSelf);
        }
    }