public GameObject LoadEffect(string name) { if (mEffects.ContainsKey(name)) { return(GameObject.Instantiate(mEffects[name])); } GameObject asset = mAssetFactory.LoadAsset(ResourcesAssetFactory.EffectPath + name) as GameObject; mEffects.Add(name, asset); return(GameObject.Instantiate(asset)); }
public GameObject LoadEffect(string name) { if (mEffects.ContainsKey(name)) { return(GameObject.Instantiate(mEffects[name])); //有没有想过如果性能瓶颈不是resourcesLoad,而是实例化呢?对象池 } else { GameObject asset = mAssetProxyFactory.LoadAsset(ResourcesAssetFactory.EffectPath + name) as GameObject; mEffects.Add(name, asset); return(asset); } }
public GameObject LoadSoldier(string name) { if (mSoldiers.ContainsKey(name)) { return(GameObject.Instantiate(mSoldiers[name])); } else { GameObject asset = mAssetFactory.LoadAsset(ResourcesAssetFactory.SoldierPath + name) as GameObject; mSoldiers.Add(name, asset); return(GameObject.Instantiate(asset)); } }
public GameObject LoadTankOne(string name) { if (mTankOne.ContainsKey(name)) { return(GameObject.Instantiate(mTankOne[name])); } else { GameObject asset = mAssetFactory.LoadAsset(ResourcesAssetFactory.OnePath + name) as GameObject; mTankOne.Add(name, asset); return(GameObject.Instantiate(asset)); } }
public GameObject LoadEnemy(string name) { if (m_Enemys.ContainsKey(name)) { return(GameObject.Instantiate(m_Enemys[name])); } else { GameObject asset = mAssetFactory.LoadAsset(Path.Combine(ResourcesAssetFactory.EnemyPath, name)) as GameObject; m_Enemys.Add(name, asset); asset.transform.position = Vector3.up * -2f; return(GameObject.Instantiate(asset)); } }
public GameObject LoadSoldier(string name) { if (soldierDict.ContainsKey(name)) { var go = soldierDict[name]; return(Object.Instantiate(go)); } else { var go = resourcesAssetFactory.LoadAsset(ResourcesAssetFactory.SoldierPath + name) as GameObject; soldierDict.Add(name, go); return(Object.Instantiate(go)); } }