void Start() { /* * ReadyManager readyManager = GameObject.Find("ReadyManager").GetComponent<ReadyManager>(); * powerCount = readyManager.GetPowerItemCount(); * bombCount = readyManager.GetBombItemCount(); */ powerCount = PlayerPrefs.GetInt("PowerItemCount", 0); bombCount = PlayerPrefs.GetInt("BombItemCount", 0); PlayerPrefs.SetInt("PowerItemCount", 0); PlayerPrefs.SetInt("BombItemCount", 0); uiManager.SetItemCountText(ItemType.POWER, powerCount); uiManager.SetItemCountText(ItemType.BOMB, bombCount); //Destroy(GameObject.Find("ReadyManager")); DefSettingIO.getInstance.GetData("PlusLife", out plusLife); DefSettingIO.getInstance.GetData("FeverTimeCount", out feverTimeCount); DefSettingIO.getInstance.GetData("PlusPower", out plusPower); DefSettingIO.getInstance.GetData("FeverPower", out feverPower); itemPool.Create(); itemPool.AddItem(); }
public void DropPowerUp() { if (ItemPool && UnityEngine.Random.Range(0f, 1f) > 0.1f && !powerUpDroped) { powerUpDroped = true; var powerUp = ItemPool.Get(); if (powerUp == null) { return; } powerUp.Spawn(transform.position); ItemPool.AddItem(powerUp); } }
// Start is called before the first frame update void Start() { ItemPool itempool = new ItemPool(); setItemPool(itempool); itempool.AddItem(new Item { itemType = Item.ItemType.sword, itemAmountt = 1, itemName = "sword", itemWorn = false, itemSTR = 5, }); itempool.AddItem(new Item { itemType = Item.ItemType.sword2, itemAmountt = 1, itemName = "sword2", itemWorn = false, itemSTR = 10, }); itempool.AddItem(new Item { itemType = Item.ItemType.sword3, itemAmountt = 1, itemName = "sword3", itemWorn = false, itemSTR = 15, }); itempool.AddItem(new Item { itemType = Item.ItemType.armor, itemAmountt = 1, itemName = "armor", itemWorn = false, itemDEX = 7, itemAGI = 10 }); itempool.AddItem(new Item { itemType = Item.ItemType.armor2, itemAmountt = 1, itemName = "armor2", itemWorn = false, itemDEX = 10, itemAGI = 4 }); itempool.AddItem(new Item { itemType = Item.ItemType.armor3, itemAmountt = 1, itemName = "armor3", itemWorn = false, itemDEX = 15, itemAGI = 1 }); itempool.AddItem(new Item { itemType = Item.ItemType.helmet, itemAmountt = 1, itemName = "helmet", itemWorn = false, itemDEX = 4, itemAGI = 3 }); itempool.AddItem(new Item { itemType = Item.ItemType.helmet2, itemAmountt = 1, itemName = "helmet2", itemWorn = false, itemDEX = 6, itemAGI = 2 }); itempool.AddItem(new Item { itemType = Item.ItemType.helmet3, itemAmountt = 1, itemName = "helmet3", itemWorn = false, itemDEX = 8, itemAGI = 1 }); itempool.AddItem(new Item { itemType = Item.ItemType.shoes, itemAmountt = 1, itemName = "shoes", itemWorn = false, itemDEX = 2, itemAGI = 5 }); itempool.AddItem(new Item { itemType = Item.ItemType.shoes2, itemAmountt = 1, itemName = "shoes2", itemWorn = false, itemDEX = 3, itemAGI = 6 }); itempool.AddItem(new Item { itemType = Item.ItemType.point, itemAmountt = 1, itemName = "point", itemWorn = false, itemSTR = 10, }); itempool.AddItem(new Item { itemType = Item.ItemType.HealthPotion, itemAmountt = 5, itemName = "health potion", }); itempool.AddItem(new Item { itemType = Item.ItemType.StaminaPotion, itemAmountt = 10, itemName = "stamina potion" }); }