Пример #1
0
    // Use this for initialization
    void Start()
    {
        XmasWorldBuilder builder = retreiveBuilderFromMap();
        EventManager     evtman  = new EventManager();
        ActionManager    actman  = new ActionManager(evtman);
        XmasFactory      factory = new GameFactory(actman);

        engine = new XmasModel(builder, actman, evtman, factory);
    }
Пример #2
0
    private XmasWorldBuilder retreiveBuilderFromMap()
    {
        var type       = typeof(MapTypes);
        var memInfo    = type.GetMember(Map.ToString());
        var attributes = memInfo[0].GetCustomAttributes(typeof(MapTypeAttribute),
                                                        false);
        var MapType = ((MapTypeAttribute)attributes[0]).Type;

        XmasWorldBuilder worldbuilder = (XmasWorldBuilder)Activator.CreateInstance(MapType);

        return(worldbuilder);
    }