public Gun New(int Id, Vector3 position) { Gun resource = Resource.First(p => p.Data.Id == Id); Gun clone = Instantiate(resource, position, transform.rotation); clone.Data = resource.Data; clone.Data.Uid = UidCreater.New(); return(clone); }
public Monster NewMonster(int Id, Vector3 position, int waveIndex) { Monster clone = MonsterResource.FirstOrDefault(p => p.Id == Id).Monster; if (clone == null) { Debug.LogErrorFormat("[MonsterFactory] Not Found Monster Id {0}", Id); } Monster newMob = Instantiate(clone, position, transform.rotation); newMob.Hp = (int)(clone.HpBase * Math.Pow(1.01, waveIndex) + waveIndex * Math.Pow(waveIndex, 1.05)); newMob.Gold = 10 + waveIndex * 2 * UnityEngine.Random.Range(0, 2); newMob.Uid = UidCreater.New(); return(newMob); }