private void HackGachaItems(List <GachaItem> itemList) { itemList.Clear(); for (int i = 0; i < this._avatarCardIDs.Length; i++) { GachaItem item = new GachaItem(); item.set_item_id((uint)this._avatarCardIDs[i]); itemList.Add(item); } }
//Single Roll public void SelectItem() { poolRange = 0; foreach (GachaItem gi in dropPool.items) { poolRange += gi.dropChance; } int roll = Random.Range(0, poolRange); int rollChance = 0; Debug.Log("drop roll was " + roll.ToString()); foreach (GachaItem g in dropPool.items) { rollChance += g.dropChance; if (rollChance > roll) { Debug.Log(g.name); SelectedItem = g; f**k = SelectedItem.type; Instantiate(SelectedItem.thing, ObjSpawnPoint.transform.position, ObjSpawnPoint.transform.rotation); break; } } if (SelectedItem.type == "Ship") { Debug.Log("it's a ship"); foreach (Ship ship in instance.shipList.ships) { if (SelectedItem.name == ship.ShipName) { ship.isUnlocked = true; if (ship.isUnlocked) { Debug.Log("FUCKIGN FINALLY " + ship.ShipName); } instance.ReloadShips(); break; } } } else if (SelectedItem.type == "Engine") { Debug.Log("drop roll was "); foreach (Engine engine in instance.engineList.engines) { if (SelectedItem.name == engine.CodeName) { Debug.Log("drop roll was "); engine.isUnlocked = true; instance.ReloadEngines(); break; } } } }