/// <summary>
        /// 逐步构建复杂产品对象
        /// </summary>
        public Actor Construct(ActorBuilder builder)
        {
            builder.BuildType();
            builder.BuildSex();
            builder.BuildFace();
            builder.BuildCostume();
            builder.BuildHairStyle();

            return(builder.CreateActor());;
        }
Esempio n. 2
0
        public static void Main(string[] args)
        {
            ActorBuilder    builder  = (ActorBuilder)AppConfigHelper.GetConcreteBuilderInstance();
            ActorController director = new ActorController();
            Actor           actor    = director.Construct(builder);

            Console.WriteLine("角色类型:{0}", actor.Type);
            Console.WriteLine("角色性别:{0}", actor.Sex);
            Console.WriteLine("角色面容:{0}", actor.Face);
            Console.WriteLine("角色服装:{0}", actor.Costume);
            Console.WriteLine("角色发型:{0}", actor.HairStyle);

            Console.ReadKey();
        }