示例#1
0
 // Update is called once per frame
 void Update()
 {
     if (active)
     {
         rectTransform.localPosition += Vector3.down * speed * Time.deltaTime;
         speed += acc;
         if (rectTransform.localPosition.y <= targetY && speed > 0)
         {
             speed = -1 * damp * speed;
             if (Mathf.Abs(speed) < 5f)
             {
                 speed = 0;
                 if (PointManager.Instance.isDraw())
                 {
                     if (onSpareggio)
                     {
                         onSpareggio.Raise(null);
                     }
                 }
                 else
                 {
                     canvasReplay.SetActive(true);
                 }
             }
         }
     }
 }
示例#2
0
    void OnGUI()
    {
        Event e = Event.current;

        if ((e.isKey && !WordsManager.Instance.isTimerOver() && !blockInput) || (isSpareggioTime && !spareggioFinished))
        {
            if (Char.ToLower(e.character) == Char.ToLower(objectToRepair.name[currentLetter]))
            {
                currentLetter++;
                text.text = "<color=#ff9300>";
                for (int i = 0; i < count; i++)
                {
                    text.text += objectToRepair.name[i];
                    if (i == currentLetter - 1)
                    {
                        text.text += "</color><color=#18247C>";
                    }
                }
                text.text += "</color>";
                if (currentLetter >= count)
                {
                    blockInput = true;
                    FinishedWord();
                    if (isSpareggioTime)
                    {
                        onSpareggioFinished.Raise(null);
                        if (red)
                        {
                            PointManager.Instance.redPoints++;
                        }
                        else
                        {
                            PointManager.Instance.bluePoints++;
                        }

                        if (OnFinishedGame)
                        {
                            OnFinishedGame.Raise(null);
                        }
                    }
                    else
                    {
                        Invoke("changeWord", pause);
                    }
                }
                else
                {
                    UpdatedWord();
                }
            }
        }
    }
示例#3
0
    IEnumerator TimerLoop()
    {
        int passedTime = 0;

        UpdateTimerText(passedTime);
        while (passedTime < totalTimeInSeconds)
        {
            yield return(new WaitForSeconds(1f));

            passedTime++;
            UpdateTimerText(passedTime);
        }
        onFinishedTime.Raise(null);
        SfxManager.Instance.PlayGameFinishedClip();
    }