コード例 #1
0
        public async Task Step()
        {
            foreach (var animal in animals)
            {
                try
                {
                    UpdateAnimal(animal);
                    await backend.AddLog(animal.Animal.AnimalId, new Log
                    {
                        Coordinate = new Coordinate(animal.Position.X, animal.Position.Y),
                        AnimalId   = animal.Animal.AnimalId,
                        DateTime   = (ulong)(DateTime.UtcNow.AddYears(-2).AddHours(6 * step) - DateTime.UnixEpoch).TotalMilliseconds
                    });

                    //Console.WriteLine($"{animal.Position.X.ToString(CultureInfo.InvariantCulture)}, {animal.Position.Y.ToString(CultureInfo.InvariantCulture)}");
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                }
            }
            step++;
        }