Ejemplo n.º 1
0
    public static void GiveItemToPlayer(Player player, PickupData item, int amount)
    {
        if (player.playerData.storedPickups.Count == 0)
        {
            item.amount += amount;
            player.playerData.storedPickups.Add(item);
        }
        else
        {
            int  i = 0;
            bool alreadyHadPickup = false;
            foreach (PickupData storedPickupData in player.playerData.storedPickups)
            {
                if (storedPickupData == item)
                {
                    player.playerData.storedPickups[i].amount += amount;
                    alreadyHadPickup = true;
                    break;
                }
                i++;
            }

            if (!alreadyHadPickup)
            {
                item.amount += amount;
                player.playerData.storedPickups.Add(item);
            }
        }

        if (item.showsInPlayer)
        {
            Player.EquipEvent?.Invoke(item);
        }

        InventoryEvent?.Invoke();
    }
Ejemplo n.º 2
0
 public void FadeIn()
 {
     FadeInEvent?.Invoke();
     transitionCanvas.Play("FadeIn");
 }