public ObjectPool(string[] _fileNames) { typeList = GenericClassCreator.GetAllTypesFromFileNames(_fileNames); foreach (string s in _fileNames) { System.Type t; typeList.TryGetValue(s, out t); if (t != null) { keys.Add(s); //values.Add(t); } } }
// Use this for initialization void Start() { textureList = new Dictionary <string, Texture>(); //BulletFactory.Instance.ToString(); //textureList = BulletFactory.Instance.typeList; op = new ObjectPool(GenericClassCreator.GetAllFileNamesInFolder(Application.dataPath + "/Resources/Textures", "png")); // BulletFactory.Instance.SpawnObject("Bullet_9mm.prefab"); //BulletFactory.Instance.SpawnObject("Bullet_9mm"); BulletFactory.Instance.ToString(); foreach (KeyValuePair <string, System.Type> kv in op.typeList) { BulletFactory.Instance.SpawnObject(kv.Key); } // BulletFactory.Instance.SpawnObject("Bullet_9mm"); // BulletFactory.Instance.SpawnObject("Bullet_9mm"); // BulletFactory.Instance.SpawnObject("Bullet_9mm"); // BulletFactory.Instance.SpawnObject("Bullet_9mm"); // BulletFactory.Instance.SpawnObject("Bullet_9mm.prefab"); }
private BulletFactory() { tlist = GenericClassCreator.GetAllTypesFromFileLocation(Application.dataPath + "/Resources/Textures"); }