Exemplo n.º 1
0
 private void Update()
 {
     //Handle click events
     if (isExpanded && !mouseIsOver && (Input.GetMouseButtonDown(0) || Input.GetMouseButtonDown(1)))
     {
         Toggle(-1);
     }
     //Effect handling
     if (!mySine.durationElapsed)
     {
         if (isExpanded)
         {
             mySine.Increment();
         }
         else
         {
             mySine.Decrement();
         }
         if (mySine.durationElapsed)
         {
             //arrowRect.rotation = Quaternion.Euler(new Vector3(0f, 0f, isExpanded ? 90f : 270f));
             background.SetActive(isExpanded);
             //scrollBar.SetActive(isExpanded); //Unhide the Bar graphic
             backgroundRect.sizeDelta = isExpanded ? sizeExpanded : sizeRetracted;
             if (doChangePosition)
             {
                 myRect.anchoredPosition = isExpanded ? new Vector2(originPosition.x, originPosition.y - deltaHeight) : originPosition;
             }
         }
         else
         {
             if (doChangePosition)
             {
                 myRect.anchoredPosition = new Vector2(originPosition.x, originPosition.y - deltaHeight * mySine.GetSine()); //Handle sizing
             }
             backgroundRect.sizeDelta = new Vector2(sizeExpanded.x, sizeRetracted.y + (sizeExpanded.y - sizeRetracted.y) * mySine.GetSine());
         }
     }
 }