Beispiel #1
0
        private async Task Aquecer(TimeSpan tick)
        {
            var sec = new TimeSpan(0, 0, 1);

            while (TempoRestante.TotalSeconds > 0 && !pedidoPausa && !pedidoCancelar)
            {
                await Task.Delay(tick);

                contadorSegundos = contadorSegundos.Add(tick);

                if (contadorSegundos.TotalMilliseconds >= sec.TotalMilliseconds)
                {
                    Aquecer();
                    contadorSegundos = contadorSegundos.Subtract(sec);
                }

                TempoRestante = TempoRestante.Subtract(tick);
            }
        }
Beispiel #2
0
        private async Task Aquecer(string caminho, TimeSpan tick)
        {
            var FS  = ServiceLocator.Get <IFileService>();
            var sec = new TimeSpan(0, 0, 1);

            using (StreamWriter sw = FS.GetStreamWriter(caminho, true))
            {
                while (TempoRestante.TotalSeconds > 0 && !pedidoPausa && !pedidoCancelar)
                {
                    await Task.Delay(tick);

                    contadorSegundos = contadorSegundos.Add(tick);

                    if (contadorSegundos.TotalMilliseconds >= sec.TotalMilliseconds)
                    {
                        Aquecer(sw);
                        contadorSegundos = contadorSegundos.Subtract(sec);
                    }

                    TempoRestante = TempoRestante.Subtract(tick);
                }
            }
            EntradaAquecida = FS.Carregar(caminho);
        }
Beispiel #3
0
 void Start()
 {
     tempoRestante = GameObject.Find("Time").GetComponent <TempoRestante>();
     player        = GameObject.Find("Player").GetComponent <Player>();
 }