Пример #1
0
    private void Awake()
    {
        foreach (var structureType in builders)
        {
            // Create a new instance of structure
            Structure structure = new Structure();

            // Fancy way of creating a builder using reflection
            StructureBuilder builder = (StructureBuilder)Activator.CreateInstance(structureType);

            builder.SetStructure(structure);

            // Fancy builder Syntax
            builder
            .BuildFirstFloor()
            .BuildSecondFloor()
            .BuildThirdFloor()
            .BuildFourthFloor();

            myStructures.Add(structure);
        }
    }