private void Inject() { // Services ImpactService impactService = new ImpactService(); // Groupal controller PortalsController portalsController = new PortalsController(); PortalUICollection portalUIList = new PortalUICollection(); portalsController.SetPortalRemoveListener(portalUIList); // Factories PlayerFactory playerFactory = new PlayerFactory(portalsController, portalsController, impactService, portalUIList); EnemyFactory enemyFactory = new EnemyFactory(impactService); PortalFactory portalFactory = new PortalFactory(portalsController, portalUIList); // References PlayerUI playerUI = GameObject.Find("/Player").GetComponent <PlayerUI>(); EnemyUI enemyUI1 = GameObject.Find("/Enemies/Enemy1").GetComponent <EnemyUI>(); EnemyUI enemyUI2 = GameObject.Find("/Enemies/Enemy2").GetComponent <EnemyUI>(); PortalUI portalUI1 = GameObject.Find("/Portals/Portal1").GetComponent <PortalUI>(); PortalUI portalUI2 = GameObject.Find("/Portals/Portal2").GetComponent <PortalUI>(); PortalUI portalUI3 = GameObject.Find("/Portals/Portal3").GetComponent <PortalUI>(); // Injection playerFactory.CreatePlayer(playerUI); enemyFactory.CreateEnemy(enemyUI1); enemyFactory.CreateEnemy(enemyUI2); portalFactory.CreatePortal(portalUI1); portalFactory.CreatePortal(portalUI2); portalFactory.CreatePortal(portalUI3); }
private static void SetConnections(JObject json, IReadOnlyDictionary <int, List <IConnection> > connections) { if (!json.ContainsKey("connections")) { return; } foreach (var jConnection in json["connections"].Children <JObject>()) { if (jConnection.ContainsKey("portal")) { PortalFactory.CreatePortal(jConnection, _rooms); continue; } ConnectionFactory.CreateConnection(jConnection, _rooms, out var conn1, out var conn2, out var roomId1, out var roomId2); connections[roomId1].Add(conn2); connections[roomId2].Add(conn1); } }
void Awake() { PlatformType = PlatformType.Local; #if (UNITY_ANDROID && !UNITY_EDITOR) #if ANDROID_OPPO PlatformType = PlatformType.OPPO; #elif ANDROID_UC PlatformType = PlatformType.UC; #elif ANDROID_XIAOMI PlatformType = PlatformType.MI; #elif ANDROID_TENCENT PlatformType = PlatformType.Tencent; #endif #endif TraceUtil.Log(PlatformType); Application.targetFrameRate = 60; m_instance = this; this.m_timedSendPackage = GetComponent <TimedSendPackage>(); this.m_playerFactory = GetComponent <PlayerFactory>(); //this.m_monsterFactory = GetComponent<MonsterFactory>(); this.m_damageFactory = GetComponent <DamageFactory>(); this.m_trapFactory = GetComponent <TrapFactory>(); this.m_portalFactory = GetComponent <PortalFactory>(); this.m_npcFactory = GetComponent <NPCFactory>(); this.m_SenceAudioFactory = GetComponent <SenceAudioFactory>(); //this.m_bulletFactory = GetComponent<BulletFactory>(); this.m_actionEffectFactory = GetComponent <ActionEffectFactory>(); LoginManager.Instance.Init91(); this.RegisterEventHandler(); this.m_gameSettings = GetComponent <GameSettings>(); //打印按钮Id TraceUtil.Log(SystemModel.Common, TaskBtnManager.Instance.GetBtnId()); }
public FacilityMap(IWorld world, MapInstruction inst) { _world = world; inst.Layers.ForEach(x => Add(LayerBuilder.Assemble(x))); inst.Portals.ForEach(x => this[x.Location].Put(PortalFactory.Create(x))); }