public bool Equals(BoloVehicle vehicle)
        {
            bool different = false;

            if (!color.Equals(vehicle.color))
            {
                different = true;
            }
            else if (!type.Equals(vehicle.type))
            {
                different = true;
            }
            else if (!doorCount.Equals(vehicle.doorCount))
            {
                different = true;
            }

            return(!different);
        }
Exemplo n.º 2
0
        private void boloTimer_Tick(object sender, EventArgs e)
        {
            Random random = new Random();
            int    num    = random.Next(100);

            //Clears old items randomly
            if (boloList.Items.Count > 0 && (num <= 25 || boloList.Items.Count >= 10))
            {
                boloList.Items.RemoveAt(random.Next(boloList.Items.Count));
            }

            if (num <= 65)
            {
                BoloVehicle newVehicle = boloGenerator.generateVehicle();
                foreach (BoloVehicle vehicle in boloList.Items)
                {
                    if (newVehicle.Equals(vehicle))
                    {
                        return;
                    }
                }
                boloList.Items.Add(boloGenerator.generateVehicle());
            }
        }
        public BoloVehicle generateVehicle()
        {
            BoloVehicle newVehicle = new BoloVehicle(generateColor(), generateType(), generateDoors(), "");

            return(newVehicle);
        }