1234567891011121314151617181920212223242526 |
-
- using GFGGame;
- namespace ET
- {
- public static class UnitFactory
- {
- public static Unit Create(Scene currentScene, UnitInfo unitInfo)
- {
- UnitComponent unitComponent = currentScene.GetComponent<UnitComponent>();
- Unit unit = unitComponent.AddChildWithId<Unit>(unitInfo.UnitId);
- unitComponent.Add(unit);
- //数值组件
- NumericComponent numericComponent = unit.AddComponent<NumericComponent>();
- unit.AddComponent<ObjectWait>();
- for (int i = 0; i < unitInfo.Ks.Count; ++i)
- {
- numericComponent.Set(unitInfo.Ks[i], unitInfo.Vs[i]);
- }
- //角色信息
- RoleDataManager.InitServerData();
- return unit;
- }
- }
- }
|