public void LoadPlayer() { if (Time.timeScale == 0f) { Time.timeScale = 1f; } PlayerData data = SaveSystem.LoadPLayer(); if (!Player) { Player = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerManager>(); } if (data == null) { ResetDefaults(); } Player.bossesProgres = data.bossesProgress; Player.Level = data.Level; Player.Stars = data.Stars; UpdatePlayerLevel.Raise(); Player.Coins = data.Coins; UpdateCoins.Raise(); Player.CurrentHealth.RuntimeValue = data.CurrentHealth; Player.CurrentHealth.InitialValue = data.MaxHealth; Equipment.Armor = new ArmorItem(); Equipment.Armor = (ArmorItem)Items.MyInventory[data.armorId]; Player.UpdateArmor.Raise(); Player.PlayerHealthSignal.Raise(); if (buffMgr) { currentBuffs.list.Clear(); for (int i = 0; i < data.buffsId.Count; i++) { BuffParametrs temp = allBuffs.list[data.buffsId[i]]; temp.timer = data.buffsTimeLeft[i]; buffMgr.Buff(temp); } } if (invMgr) { Inv.MyInventory.Clear(); invMgr.ClearInventory(); for (int i = 0; i < data.itemsId.Count; i++) { InventoryItem item = Items.MyInventory[data.itemsId[i]]; item.NumberHeld = data.itemsValue[i]; Inv.MyInventory.Add(item); invMgr.AddItem(item); } } if (shopMgr) { Shop.MyInventory.Clear(); shopMgr.ClearInventory(); for (int i = 0; i < data.shopId.Count; i++) { InventoryItem item = Items.MyInventory[data.shopId[i]]; Shop.MyInventory.Add(item); } } Player.Weapons.thisList.Clear(); Player.SetWeaponAlpha(0); for (int i = 0; i < data.weaponsId.Count; i++) { Player.SetWeaponAlpha(1); Rigidbody2D temp = Items.MyInventory[data.weaponsId[i]].ThisItem.GetComponent <Rigidbody2D>(); Player.Weapons.thisList.Add(temp); Player.ChangeCurrentItem(); } UpdateInv.Raise(); UpdateShop.Raise(); }
public void OnUse() { BuffManager mgr = GameObject.FindGameObjectWithTag("GameController").GetComponent <BuffManager>(); mgr.Buff(parametrs); }