Food in Ärsche schieben

This commit is contained in:
Simon Lübeß
2024-04-07 12:39:05 +02:00
parent f9d950c557
commit feb82edcd1
3 changed files with 199 additions and 13 deletions

View File

@ -2,6 +2,7 @@ using System.Collections;
using System.Collections.Generic;
using Data;
using Interaction;
using TMPro.Examples;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.EventSystems;
@ -182,11 +183,32 @@ public class Character : MonoBehaviour
{
Debug.Log($"Gebe {_carriedInteractible.Name} an {developer.Name}");
Interactible item = _carriedInteractible;
PickupInteractible item = _carriedInteractible;
if (item == null)
return;
PickupItem(null);
switch (item.ItemType)
{
case ItemType.Coffee:
developer.GiveDrink(0.4, WantedConsumable.Drink);
break;
case ItemType.Mate:
developer.GiveDrink(0.4, WantedConsumable.Mate);
break;
case ItemType.Pizza:
developer.GiveFood(0.25, WantedConsumable.Pizza);
break;
}
item.UsesLeft--;
if (item.UsesLeft <= 0)
{
PickupItem(null);
Destroy(item.gameObject);
Destroy(item.gameObject);
}
}
public void SayItsImpossible()

View File

@ -2,6 +2,13 @@
namespace Interaction
{
public enum ItemType
{
Mate,
Coffee,
Pizza
}
public class PickupInteractible : Interactible
{
[SerializeField]
@ -9,10 +16,17 @@ namespace Interaction
[SerializeField]
private string _name;
[SerializeField]
private ItemType _itemType;
public int UsesLeft = 1;
public GameObject Model => _model;
public string Name => _name;
public ItemType ItemType => _itemType;
}
}