示例#1
0
    /// <summary>
    /// Disables the Hotspot for the button, changes its Sprite and sets the value
    /// for the current strong box combination
    /// </summary>
    public void PressButton()
    {
        // disable the Hotspot linked to the button
        if (buttonHotspot != null)
        {
            buttonHotspot.TurnOff();
        }

        // change the button sprite
        if (m_spriteRenderer != null && buttonPressed != null)
        {
            m_spriteRenderer.sprite = buttonPressed;
        }

        // play the sound effect
        if (m_audioSource != null)
        {
            m_audioSource.Play();
        }

        // send the value of the button to the current combination of the strong box
        if (basementLogic != null)
        {
            basementLogic.AddCombinationStep(value);
        }
    }
 private void DoChange(Hotspot _hotspot)
 {
     if (changeType == ChangeType.Enable)
     {
         _hotspot.TurnOn();
     }
     else
     {
         _hotspot.TurnOff();
     }
 }
示例#3
0
        /**
         * <summary>Deserialises a string of data, and restores the GameObject to its previous state.</summary>
         * <param name = "stringData">The data, serialised as a string</param>
         */
        public override void LoadData(string stringData)
        {
            HotspotData data = Serializer.LoadScriptData <HotspotData> (stringData);

            if (data == null)
            {
                loadedData = false;
                return;
            }
            SavePrevented = data.savePrevented; if (savePrevented)
            {
                return;
            }

            if (data.isOn)
            {
                gameObject.layer = LayerMask.NameToLayer(KickStarter.settingsManager.hotspotLayer);
            }
            else
            {
                gameObject.layer = LayerMask.NameToLayer(KickStarter.settingsManager.deactivatedLayer);
            }

            if (GetComponent <Hotspot>())
            {
                Hotspot _hotspot = GetComponent <Hotspot>();

                if (data.isOn)
                {
                    _hotspot.TurnOn();
                }
                else
                {
                    _hotspot.TurnOff();
                }

                StringToButtonStates(_hotspot, data.buttonStates);

                if (data.hotspotName != "")
                {
                    _hotspot.SetName(data.hotspotName, data.displayLineID);
                }
                _hotspot.ResetMainIcon();
            }

            loadedData = true;
        }
 private void DoChange(Hotspot _hotspot)
 {
     if (changeType == ChangeType.Enable)
     {
         _hotspot.TurnOn ();
     }
     else
     {
         _hotspot.TurnOff ();
     }
 }