Interaktionen 2.0
This commit is contained in:
@ -1,15 +1,18 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Interaction;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Serialization;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class UiController : MonoBehaviour
|
||||
{
|
||||
[FormerlySerializedAs("_pickupper")]
|
||||
[Header("Objects")]
|
||||
[SerializeField]
|
||||
private Pickupper _pickupper;
|
||||
private InteractionHandler interactionHandler;
|
||||
|
||||
[Header("UI Elements")]
|
||||
[SerializeField]
|
||||
@ -28,16 +31,36 @@ public class UiController : MonoBehaviour
|
||||
|
||||
private void UpdateActionDisplay()
|
||||
{
|
||||
bool show = _pickupper.PickupablesInRange.Count > 0;
|
||||
bool show = interactionHandler.InteractionsInRange.Count > 0;
|
||||
|
||||
_actionDisplay.SetActive(show);
|
||||
|
||||
if (!show)
|
||||
return;
|
||||
|
||||
_actionText.text = $"{_pickupper.Selected.Name}";
|
||||
switch (interactionHandler.SelectedAction)
|
||||
{
|
||||
case PickupInteractible pickup:
|
||||
_actionText.text = $"Hebe {pickup.Name} auf";
|
||||
break;
|
||||
case UseInteractible usable:
|
||||
_actionText.text = usable.UseText;
|
||||
break;
|
||||
case GiveItemInteractible giveItem:
|
||||
_actionText.text = $"Gebe {GameManager.Instance.Player.CarriedItem?.Name ?? "keinen Gegenstand"} an {giveItem.Developer.Name}";
|
||||
break;
|
||||
default:
|
||||
_actionText.text = $"Unbekannte Aktion";
|
||||
break;
|
||||
// case InteractibleType.Use:
|
||||
// _actionText.text = $"{_pickupper.Selected.Name} benutzen";
|
||||
// break;
|
||||
// case InteractibleType.Give:
|
||||
// _actionText.text = $"An {_pickupper.Selected.Name} geben";
|
||||
// break;
|
||||
}
|
||||
|
||||
_prevActionButton.interactable = _pickupper.CanSelectPrevious;
|
||||
_nextActionButton.interactable = _pickupper.CanSelectNext;
|
||||
//_prevActionButton.interactable = _pickupper.CanSelectPrevious;
|
||||
//_nextActionButton.interactable = _pickupper.CanSelectNext;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user