public void Randomize() { var body = Instantiate(Repos.RifleRepo.GetRandomBody(), transform); var stock = Instantiate(Repos.RifleRepo.GetRandomStock()); var mag = Instantiate(Repos.RifleRepo.GetRandomMag()); var barrel = Instantiate(Repos.RifleRepo.GetRandomBarrel()); Initialize(WeaponGenerator.GenerateNewRifle(ItemQuality.Common), body.transform, barrel.transform, stock.transform, mag.transform); }
void GenerateNewRifle() { var rifle = Instantiate(RiflePrefab, Platform).GetComponent <Rifle>(); var body = Instantiate(Repos.RifleRepo.GetRandomBody(), rifle.transform); var stock = Instantiate(Repos.RifleRepo.GetRandomStock()); var mag = Instantiate(Repos.RifleRepo.GetRandomMag()); var barrel = Instantiate(Repos.RifleRepo.GetRandomBarrel()); var quality = Enum.GetValues(typeof(ItemQuality)).Cast <ItemQuality>().PickOne(); rifle.Initialize(WeaponGenerator.GenerateNewRifle(quality), body.transform, barrel.transform, stock.transform, mag.transform); Panel.FillRifleStats(rifle.GetWeaponStats() as RifleStats); currentRifleStats = rifle.GetWeaponStats() as RifleStats; currentRifleData = new RifleAssemblyData { BarrelId = barrel.GetComponent <AssemblyPart>().AssemblyPartId, BodyId = body.GetComponent <AssemblyPart>().AssemblyPartId, StockId = stock.GetComponent <AssemblyPart>().AssemblyPartId, MagId = mag.GetComponent <AssemblyPart>().AssemblyPartId, }; }