Ejemplo n.º 1
0
        public static EstadoNiveles FromString(string s)
        {
            var e = new EstadoNiveles();

            string[] arr = s.Split(';');
            e.Agua        = int.Parse(arr[0]);
            e.Combustible = int.Parse(arr[1]);
            e.Pulsador    = bool.Parse(arr[2]);
            return(e);
        }
        public EstadoNiveles EstadoNiveles(int id_carro)
        {
            var r = new Random();

            var en = new EstadoNiveles
            {
                Identificacion = id_carro,
                Agua           = r.Next(7),
                Combustible    = r.Next(5),
                Pulsador       = (r.Next(2) != 0 ? true : false)
            };

            return(en);
        }
        public string EstadoNiveles_s(int id_carro)
        {
            EstadoNiveles en = EstadoNiveles(id_carro);

            return(en.ToString(false));
        }