Beispiel #1
0
 //This starts the movement of the reel and resets the animations
 public void startMoving()
 {
     isStopped  = false;
     shouldSpin = true;
     if (iconToStop.image != null)
     {
         iconToStop.image.color = new Color(iconToStop.image.color.r, iconToStop.image.color.g, iconToStop.image.color.b, 1);
     }
     iconToStop    = null;
     isSlowingDown = false;
     stopIdx       = -1;
 }
Beispiel #2
0
    //Animates the alpha of the stopped Icon
    IEnumerator animateWinningIcon(ReelIconContainer icon)
    {
        shouldAnimateWin = true;
        float t = 0;

        int sign = 1;

        while (shouldAnimateWin)
        {
            t += Time.deltaTime / winAnimationSpeed * sign;
            icon.image.color = Color.Lerp(animStartColor, animEndColor, t);
            if (t >= 1 || t <= 0)
            {
                sign *= -1; t = Mathf.Clamp01(t);
            }
            yield return(null);
        }
    }
Beispiel #3
0
 //Loops the Icon back to the top after it has passed a threshold. Also checks for the stop idx and begins
 //the stop if valid
 void resetIconPosition(ReelIconContainer icon)
 {
     if (icon.rectTransform.transform.position.y <= (reelView.transform.position.y - (reelView.rect.height / 2) - (icon.rectTransform.rect.height / 2)))
     {
         //icon.transform.position = reelView.transform.position + (((reelView.rect.height / 2) + (reelIconPrefab.rect.height / 2)) * Vector3.up);
         icon.rectTransform.transform.position += Vector3.up * (reelView.rect.height + icon.rectTransform.rect.height);
         reelIdx--;
         if (reelIdx < 0)
         {
             reelIdx = reelStripType.reelType.Length - 1;
         }
         if (reelIdx == stopIdx)
         {
             iconToStop    = icon;
             isSlowingDown = true;
         }
         icon.image.sprite = manager.getReelIcon(reelStripType.reelType[reelIdx]);
     }
 }