コード例 #1
0
        public void PlantarSemillas()
        {
            bool   flag   = false;
            Random random = new Random();
            int    cant   = random.Next(1, 10);

            foreach (Robot.Robot tempo in granjaSeleccionada.getRobots())
            {
                if (tempo.getEstado() == "Disponible" && tempo.getCantSemillas() > 10)
                {
                    tempo.setCantSemillas(tempo.getCantSemillas() - cant);
                    tempo.setEstado("Plantando Semillas");
                    Console.WriteLine("Se ha reservado un robot para regar los cultivos.");
                    for (int i = 0; i < cant; i++)
                    {
                        Cultivo.Cultivo temp = new Cultivo.Cultivo();
                        granjaSeleccionada.setCultivos(temp);
                        flag = true;
                    }
                    break;
                }
                else if (tempo.getEstado() == "Disponible" && tempo.getCantSemillas() < 10)
                {
                    Console.WriteLine("El robot no tiene suficiente semillas para cultivar mas");
                }
            }
            if (flag == false)
            {
                Console.WriteLine("No hay Robots Disponibles");
            }
        }
コード例 #2
0
 public void setDomo(Cultivo.Cultivo value)
 {
     domo.Add(value);
 }
コード例 #3
0
 public void setCultivos(Cultivo.Cultivo value)
 {
     cultivos.Add(value);
 }