// function used to simulate one day of travel
        private void OneDayOfTravel()
        {
            engine.OneDayOfTravel(); // Engine.cs should have a similar method
            // first, everyone needs to eat and breathe
            double foodUse = 0.0;
            double O2use   = 0.0;

            foreach (Human h in crew)
            {
                foodUse += h.Eat();
                O2use   += h.Breathe();
            }
            foodSupply.Amount -= foodUse;
            foodSupply.HowMuchLeft();
            oxygenSupply.Amount -= O2use;
            oxygenSupply.HowMuchLeft();
            genericWaste.Amount += 50.0;
            genericWaste.HowMuchLeft();
            // now, take care of the equipment
            foreach (ITool tool in equipment)
            {
                tool.Conserve();
            }
            // and use scientists to collect some data
            foreach (Human human in crew)
            {
                if (human.GetType().Equals(typeof(Scientist))) //meaning: if this human is a scientist
                {
                    Scientist tmp = (Scientist)human;          //meaning: treat human as a member of the Scientist class specifically
                    tmp.Work();
                }
            }
            Console.WriteLine();
        }
Esempio n. 2
0
 public override void CheckSupplies()
 {
     base.CheckSupplies();
     nuclearWaste.HowMuchLeft();
 }