Beispiel #1
0
        protected override Monster createMonster(MonsterFactoryParameter param)
        {   //...此处省略可能的初始化工作
            MonsterAFacotryParameter A_param = param as MonsterAFacotryParameter;

            return(new MonsterA()
            {
                Weapon = A_param.Weapon,
                Name = A_param.Name
            });
        }
Beispiel #2
0
        void Start()
        {
            //Create  observable的工厂 用一个函数创建一个obs 此函数内部的执行就像是一个流 且必须有complete或者error在结尾处
            MonsterAFacotryParameter param = new MonsterAFacotryParameter()
            {
                Name = "guaishou", Weapon = "yanshen"
            };
            var factory = FactoryManager.GetMonsterFactory <MonsterA>(param);

            factory.Subscribe(MonsterA => print(MonsterA.Name + " " + MonsterA.Weapon));
        }