示例#1
0
 public void BuildHouse(House house, TeamLeader leader)
 {
     if (house.basement == null) // clean
     {
         Basement basement = new Basement();
         basement.Work(house);
         leader.message.Add($"Worker {Name} create basement...");
     }
     if (house.door == null)
     {
         Door door = new Door(DoorType.Glasses);
         door.Work(house);
         leader.message.Add($"Worker {Name} create door...");
     }
     if (house.walls == null)
     {
         house.walls = new List <Walls>();
         Walls walls_ = new Walls();
         walls_.Work(house);
         leader.message.Add($"Worker {Name} create walls...");
     }
     if (house.window == null)
     {
         house.window = new List <Window>();
         Window window_ = new Window(TypeWindow.Regtangle);
         window_.Work(house);
         leader.message.Add($"Worker {Name} create window...");
     }
     if (house.roof == null)
     {
         Roof roof = new Roof(TypeRoof.Cement);
         roof.Work(house);
         leader.message.Add($"Worker {Name} create roof...");
     }
 }
示例#2
0
 public Team(TeamLeader leader)
 {
     this.leader = leader;
     workers     = new List <Worker> {
         new Worker("Ivan"), new Worker("Vasya"), new Worker("Andrii")
     };
 }
示例#3
0
        static void Main(string[] args)
        {
            TeamLeader leader = new TeamLeader("Vasil");
            Team       team   = new Team(leader);
            House      house  = new House();
            Worker     worker = new Worker("Katya");

            team.workers.Add(worker);
            Console.WriteLine(worker);
            foreach (var item in team.workers)
            {
                Console.WriteLine(item);
            }
            worker.BuildHouse(house, leader);
            foreach (var item in leader.message)
            {
                Console.WriteLine(item);
            }
            house.RenderHouse();
        }