Пример #1
0
    }                                                  // For external access of script

    void Awake()
    {
        if (Ref == null)
        {
            Ref = GetComponent <ManFactory>();
        }
    }
Пример #2
0
            public static void Demo()
            {
                ManFactory   manFactory   = new ManFactory();
                WomanFactory womanFactory = new WomanFactory();
                RobotFactory robotFactory = new RobotFactory();

                List <Person> people = new List <Person>
                {
                    manFactory.CreatePerson(),
                              womanFactory.CreatePerson(),
                              robotFactory.CreatePerson(),
                              robotFactory.CreatePerson(),
                              manFactory.CreatePerson(),
                };

                foreach (Person item in people)
                {
                    item.doSomethins();
                }
            }