Пример #1
0
    IEnumerator OnButtonPress()
    {
        // TODO: Try to use animator
        if (lastSelectedItem!=this && !isAnimated)
        {
            isAnimated=true;

            if (lastSelectedItem!=null)
            {
                #region Remove highlight for touch devices
#if TOUCH_DEVICE
                lastSelectedItem.renderer.material.color=Color.white;
#endif
                #endregion

                #region Hide previous selected items
                StartCoroutine(lastSelectedItem.hideItems());
                yield return new WaitForSeconds(hideDelay);
                #endregion
            }

            #region Highlight button for touch devices
#if TOUCH_DEVICE
            renderer.material.color=Color.green;
#endif
            #endregion

            #region Show items
            lastSelectedItem=this;
            StartCoroutine(showItems());
            yield return new WaitForSeconds(showDelay);
            #endregion

            isAnimated=false;
        }
    }
Пример #2
0
 void Start()
 {
     lastSelectedItem = null;
     isAnimated=false;
 }