Example #1
0
    public void StartGame(World world)
    {
        int limit = GameController.CurrentBoard.map.timeLimit;

        usesLimit  = limit > 0;
        running    = false;
        tick       = 10;
        time.color = Color.green;
        time.text  = usesLimit ?  UIHelpers.ConvertToMillisecondsTimeString((float)limit) : "00:00:00";
    }
Example #2
0
    void Update()
    {
        if (running)
        {
            if (usesLimit)
            {
                finalTime = endTime - Time.time;

                if (finalTime < (float)tick + 0.05f)
                {
                    if (tick == 0)
                    {
                    }
                    else
                    {
                        SoundController.PlaySoundEffect(Sounds.TICK);
                    }
                    tick--;
                }

                if (finalTime <= 10f)
                {
                    time.color = Color.red;
                }

                time.text = UIHelpers.ConvertToMillisecondsTimeString(finalTime);
                if (Time.time > endTime)
                {
                    running   = false;
                    time.text = "00:00:00";
                    GameController.Timeout();
                }
            }
            else
            {
                finalTime = Time.time - startTime;
                time.text = UIHelpers.ConvertToMillisecondsTimeString(finalTime);
            }
        }
    }