Compare commits

...

3 Commits

Author SHA1 Message Date
Simon Lübeß a0c4ce5ec1 Items droppen 2024-04-07 00:15:37 +02:00
Simon Lübeß 40b2ab5bde Fixed Item swap 2024-04-07 00:14:00 +02:00
Simon Lübeß dfe1451d3b Interaktionen 2.0 2024-04-07 00:09:59 +02:00
42 changed files with 1696 additions and 222 deletions

View File

@ -1,5 +1,6 @@
fileFormatVersion: 2
guid: 73951a4b66414d24999d439134425a40
guid: 8acbb259ea6cd3646b8011b843d9d40e
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 7ed699d043b764e4a8f0dcea8eaf8efb
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: ef3ce3e956711194f80fafa832fe7655
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,23 @@
fileFormatVersion: 2
guid: 9d82386c43ce7944ab7a78305ae045c5
AudioImporter:
externalObjects: {}
serializedVersion: 7
defaultSettings:
serializedVersion: 2
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
preloadAudioData: 0
platformSettingOverrides: {}
forceToMono: 0
normalize: 1
loadInBackground: 0
ambisonic: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,23 @@
fileFormatVersion: 2
guid: e169dd8360db2cd4dadd12d44c50beab
AudioImporter:
externalObjects: {}
serializedVersion: 7
defaultSettings:
serializedVersion: 2
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
preloadAudioData: 0
platformSettingOverrides: {}
forceToMono: 0
normalize: 1
loadInBackground: 0
ambisonic: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,23 @@
fileFormatVersion: 2
guid: dcc846c8a9b316547bf051a016e49fa0
AudioImporter:
externalObjects: {}
serializedVersion: 7
defaultSettings:
serializedVersion: 2
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
preloadAudioData: 0
platformSettingOverrides: {}
forceToMono: 0
normalize: 1
loadInBackground: 0
ambisonic: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,23 @@
fileFormatVersion: 2
guid: 32384529849285849a7aa370e502046f
AudioImporter:
externalObjects: {}
serializedVersion: 7
defaultSettings:
serializedVersion: 2
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
preloadAudioData: 0
platformSettingOverrides: {}
forceToMono: 0
normalize: 1
loadInBackground: 0
ambisonic: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,23 @@
fileFormatVersion: 2
guid: 1cd31e4d8fd50b6448f51db8abe18403
AudioImporter:
externalObjects: {}
serializedVersion: 7
defaultSettings:
serializedVersion: 2
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
preloadAudioData: 0
platformSettingOverrides: {}
forceToMono: 0
normalize: 1
loadInBackground: 0
ambisonic: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 6fbd5e104aa038e4598376c813cc20c6
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,20 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 62867debe01c41d89e01687ef2722fcd, type: 3}
m_Name: GottfriedData
m_EditorClassIdentifier:
Say_Impossible:
- {fileID: 8300000, guid: 9d82386c43ce7944ab7a78305ae045c5, type: 3}
- {fileID: 8300000, guid: e169dd8360db2cd4dadd12d44c50beab, type: 3}
- {fileID: 8300000, guid: dcc846c8a9b316547bf051a016e49fa0, type: 3}
- {fileID: 8300000, guid: 32384529849285849a7aa370e502046f, type: 3}
- {fileID: 8300000, guid: 1cd31e4d8fd50b6448f51db8abe18403, type: 3}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 503e4ea097b9faa4ba6e2ed3906714a5
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,174 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using Interaction;
using JetBrains.Annotations;
using UnityEngine;
using UnityEngine.Serialization;
using Utility;
public class InteractionHandler : MonoBehaviour
{
[SerializeField] private Character _character;
[FormerlySerializedAs("_pickupRadius")] [SerializeField, Tooltip("Der Radius in dem Gottfried Gegenstände aufheben kann."), Min(0.0f)]
private float interactionRadius = 1.5f;
/// <summary>
/// Der Radius in dem Gottfried Gegenstände aufheben kann.
/// </summary>
public float InteractionRadius => interactionRadius;
[FormerlySerializedAs("_pickupCollider")] [SerializeField]
private CapsuleCollider _interactionCollider;
[FormerlySerializedAs("_pickupablesInRange")] [SerializeField]
private List<Interactible> _interactionsInRange = new();
public IReadOnlyList<Interactible> InteractionsInRange => _interactionsInRange;
private int _selectedActionIndex = 0;
public Interactible SelectedAction
{
get
{
FixSelection();
return _selectedActionIndex == -1 ? null : InteractionsInRange[_selectedActionIndex];
}
}
void Update()
{
if (Input.GetKeyDown(KeyCode.LeftArrow))
{
SelectPreviousAction();
}
if (Input.GetKeyDown(KeyCode.RightArrow))
{
SelectNextAction();
}
if (Input.GetKeyDown(KeyCode.E))
{
DoInteraction();
}
}
private void DoInteraction()
{
if (InteractionsInRange.Count == 0)
return;
Interactible interactible = SelectedAction;
if (interactible.IsBlocked())
{
_character.SayItsImpossible();
return;
}
switch (interactible)
{
case PickupInteractible pickup:
UnhighlightPickupable(interactible);
_character.PickupItem(pickup);
break;
case UseInteractible usable:
usable.OnUse?.Invoke();
break;
case GiveItemInteractible giveItemAction:
_character.GiveItemTo(giveItemAction.Developer);
break;
}
}
public void SelectPreviousAction()
{
_selectedActionIndex--;
UpdateSelection();
}
public void SelectNextAction()
{
_selectedActionIndex++;
UpdateSelection();
}
private void FixSelection()
{
if (_interactionsInRange.Count == 0)
{
_selectedActionIndex = -1;
}
else
{
if (_selectedActionIndex < 0)
_selectedActionIndex = InteractionsInRange.Count - 1;
else if (_selectedActionIndex >= InteractionsInRange.Count)
_selectedActionIndex = 0;
}
}
private void UpdateSelection()
{
FixSelection();
int index = 0;
foreach (Interactible pickupable in _interactionsInRange)
{
pickupable.SetSelected(index == _selectedActionIndex);
index++;
}
}
private void OnTriggerEnter(Collider other)
{
Interactible interactible = other.gameObject.GetComponent<Interactible>();
if (interactible)
{
HighlightPickupable(interactible);
}
}
void OnTriggerExit(Collider other)
{
Interactible interactible = other.gameObject.GetComponent<Interactible>();
if (interactible)
{
UnhighlightPickupable(interactible);
}
}
private void HighlightPickupable(Interactible interactible)
{
if (!_interactionsInRange.Contains(interactible))
_interactionsInRange.Add(interactible);
interactible.Highlight(true);
UpdateSelection();
}
private void UnhighlightPickupable(Interactible interactible)
{
interactible.Highlight(false);
_interactionsInRange.Remove(interactible);
UpdateSelection();
}
// Wird aufgerufen, wenn ein Wert im Editor geändert wird
void OnValidate()
{
if (_interactionCollider)
{
_interactionCollider.radius = interactionRadius;
}
}
}

View File

@ -1,41 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Pickupable : MonoBehaviour
{
[SerializeField]
private Outline _outline;
[SerializeField]
private Color _selectedColor = Color.white;
[SerializeField]
private Color _highlightColor = Color.yellow;
[SerializeField]
private GameObject _model;
[SerializeField]
private string _name;
public GameObject Model => _model;
public string Name => _name;
public void Highlight(bool hightlight)
{
_outline.enabled = hightlight;
_outline.OutlineColor = _highlightColor;
_outline.OutlineWidth = 2;
}
public void SetSelected(bool isSelected)
{
Highlight(true);
if (isSelected)
{
_outline.OutlineColor = _selectedColor;
_outline.OutlineWidth = 4;
}
}
}

View File

@ -1,140 +0,0 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Serialization;
using Utility;
public class Pickupper : MonoBehaviour
{
[SerializeField] private Character _character;
[SerializeField, Tooltip("Der Radius in dem Gottfried Gegenstände aufheben kann."), Min(0.0f)]
private float _pickupRadius = 1.5f;
/// <summary>
/// Der Radius in dem Gottfried Gegenstände aufheben kann.
/// </summary>
public float PickupRadius => _pickupRadius;
[SerializeField]
private CapsuleCollider _pickupCollider;
[SerializeField]
private List<Pickupable> _pickupablesInRange = new();
public IReadOnlyList<Pickupable> PickupablesInRange => _pickupablesInRange;
private int _selectedActionIndex = 0;
public bool CanSelectPrevious => _selectedActionIndex > 0;
public bool CanSelectNext => _selectedActionIndex < PickupablesInRange.Count - 1;
public Pickupable Selected => PickupablesInRange[_selectedActionIndex];
void Update()
{
if (Input.GetKeyDown(KeyCode.LeftArrow))
{
SelectPreviousAction();
}
if (Input.GetKeyDown(KeyCode.RightArrow))
{
SelectNextAction();
}
if (Input.GetKeyDown(KeyCode.E))
{
PickUp();
}
}
private void PickUp()
{
if (PickupablesInRange.Count == 0)
return;
Pickupable pickupable = Selected;
UnhighlightPickupable(pickupable);
_character.PickupItem(pickupable);
}
public void SelectPreviousAction()
{
_selectedActionIndex--;
UpdateSelection();
}
public void SelectNextAction()
{
_selectedActionIndex++;
UpdateSelection();
}
private void UpdateSelection()
{
if (_pickupablesInRange.Count > 0)
{
_selectedActionIndex = Math.Clamp(_selectedActionIndex, 0, PickupablesInRange.Count - 1);
}
else
{
_selectedActionIndex = 0;
}
int index = 0;
foreach (Pickupable pickupable in _pickupablesInRange)
{
pickupable.SetSelected(index == _selectedActionIndex);
index++;
}
}
private void OnTriggerEnter(Collider other)
{
Pickupable pickupable = other.gameObject.GetComponent<Pickupable>();
if (pickupable)
{
HighlightPickupable(pickupable);
}
}
void OnTriggerExit(Collider other)
{
Pickupable pickupable = other.gameObject.GetComponent<Pickupable>();
if (pickupable)
{
UnhighlightPickupable(pickupable);
}
}
private void HighlightPickupable(Pickupable pickupable)
{
if (!_pickupablesInRange.Contains(pickupable))
_pickupablesInRange.Add(pickupable);
pickupable.Highlight(true);
UpdateSelection();
}
private void UnhighlightPickupable(Pickupable pickupable)
{
pickupable.Highlight(false);
_pickupablesInRange.Remove(pickupable);
UpdateSelection();
}
// Wird aufgerufen, wenn ein Wert im Editor geändert wird
void OnValidate()
{
if (_pickupCollider)
{
_pickupCollider.radius = _pickupRadius;
}
}
}

View File

@ -9,7 +9,7 @@ GameObject:
serializedVersion: 6
m_Component:
- component: {fileID: 7893531080884699271}
- component: {fileID: 4280275870243255345}
- component: {fileID: 8850766705489312849}
- component: {fileID: 2286779905131135538}
- component: {fileID: 4629894269612581168}
- component: {fileID: 5613880609024852887}
@ -37,7 +37,7 @@ Transform:
- {fileID: 4434707174583728378}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &4280275870243255345
--- !u!114 &8850766705489312849
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
@ -46,7 +46,7 @@ MonoBehaviour:
m_GameObject: {fileID: 5778247514781970299}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 36d05f0291670f94c9430f1f5e2604a8, type: 3}
m_Script: {fileID: 11500000, guid: 4cae243dedd2499e8326b9ed6de6e32e, type: 3}
m_Name:
m_EditorClassIdentifier:
_outline: {fileID: 6730156945272532712}
@ -54,6 +54,7 @@ MonoBehaviour:
_highlightColor: {r: 1, g: 0.92156863, b: 0.015686275, a: 1}
_model: {fileID: 5778247514781970299, guid: c3e6a58c9ab23be44a0ae88dd246b3c4, type: 3}
_name: Pizza
_interactibleType: 0
--- !u!65 &2286779905131135538
BoxCollider:
m_ObjectHideFlags: 0

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,12 @@
using System.Collections;
using System.Collections.Generic;
using Data;
using Interaction;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.EventSystems;
using UnityEngine.Serialization;
using Utility;
public class Character : MonoBehaviour
{
@ -33,7 +38,20 @@ public class Character : MonoBehaviour
[Header("Hold item")]
[SerializeField] private Transform _hand;
[SerializeField] private GameObject _carriedItem;
[FormerlySerializedAs("_carriedItem")] [SerializeField] private GameObject _carriedItemModel;
[SerializeField] private PickupInteractible _carriedInteractible;
[FormerlySerializedAs("_throwAsideForce")] [SerializeField, Tooltip("Die Kraft mit der der Gegenstand fallen gelassen wird.")]
private float _dropItemForce = 3.0f;
[SerializeField]
private GottfriedData _data;
[SerializeField]
private AudioSource _audioSource;
public bool CarriesItem => _carriedInteractible;
public PickupInteractible CarriedItem => _carriedInteractible;
// Start is called before the first frame update
void Start()
@ -62,25 +80,24 @@ public class Character : MonoBehaviour
}
public void PickupItem(Pickupable itemToPickup)
public void PickupItem(PickupInteractible itemToPickup)
{
if (_carriedItem)
if (_carriedInteractible)
{
Pickupable pickupable = _carriedItem.GetComponentInChildren<Pickupable>(true);
pickupable.gameObject.SetActive(true);
pickupable.transform.parent = null;
_carriedInteractible.gameObject.SetActive(true);
_carriedInteractible.transform.parent = null;
pickupable.transform.position = _carriedItem.transform.position;
pickupable.transform.rotation = _carriedItem.transform.rotation;
_carriedInteractible.transform.position = _carriedItemModel.transform.position;
_carriedInteractible.transform.rotation = _carriedItemModel.transform.rotation;
Rigidbody rigidbody = pickupable.GetComponent<Rigidbody>();
Rigidbody rigidbody = _carriedInteractible.GetComponent<Rigidbody>();
rigidbody.AddForce(Random.insideUnitSphere * 2.0f, ForceMode.Impulse);
rigidbody.AddForce(Random.insideUnitSphere * _dropItemForce, ForceMode.Impulse);
Destroy(_carriedItem);
Destroy(_carriedItemModel);
_carriedItem = null;
_carriedItemModel = null;
_carriedInteractible = null;
}
if (itemToPickup)
@ -90,7 +107,8 @@ public class Character : MonoBehaviour
itemToPickup.transform.parent = model.transform;
itemToPickup.gameObject.SetActive(false);
_carriedItem = model;
_carriedItemModel = model;
_carriedInteractible = itemToPickup;
}
}
@ -118,6 +136,10 @@ public class Character : MonoBehaviour
Invoke(nameof(ResetJump), jumpCooldown);
}
if (Input.GetKeyDown(KeyCode.G))
{
PickupItem(null);
}
}
private void MovePlayer()
@ -149,4 +171,16 @@ public class Character : MonoBehaviour
{
readyToJump = true;
}
public void GiveItemTo(Developer developer)
{
Debug.Log($"Gebe {_carriedInteractible.Name} an {developer.Name}");
PickupItem(null);
}
public void SayItsImpossible()
{
_audioSource.PlayOneShot(_data.VoiceSayItsImpossible.GetRandomElement());
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 1c773f750690456bbc885176d7935367
timeCreated: 1712430313

View File

@ -0,0 +1,11 @@
using UnityEngine;
using UnityEngine.Serialization;
namespace Data
{
[CreateAssetMenu(fileName = "GottfriedData", menuName = "DataObjects/GottfriedData", order = 0)]
public class GottfriedData : ScriptableObject
{
[FormerlySerializedAs("Say_Impossible")] public AudioClip[] VoiceSayItsImpossible;
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 62867debe01c41d89e01687ef2722fcd
timeCreated: 1712430327

View File

@ -39,11 +39,17 @@ public struct DeveloperStats
public class Developer : MonoBehaviour
{
[Header("Basis Informationen")]
[SerializeField]
private string _name;
[SerializeField]
private DeveloperStats _baseStats = DeveloperStats.Default;
[SerializeField]
private float _talkRange = 2.0f;
[Header("Aktuelle Informationen")]
[SerializeField, ShowOnly]
private double _currentEfficiency = 1.0;
@ -74,9 +80,6 @@ public class Developer : MonoBehaviour
[SerializeField]
private DeveloperNeeds _developerNeeds;
[SerializeField]
private float _talkRange = 2.0f;
/// <summary>
/// Gibt die Grunddaten des Entwicklers zurück.
/// </summary>

View File

@ -14,7 +14,7 @@ public partial class GameManager : MonoBehaviourSingleton<GameManager>
public GameObject NeedFullfilledParticleEffect;
[SerializeField]
private GameObject _player;
private Character _player;
[SerializeField]
private double _totalGameDurationSeconds;
@ -52,6 +52,8 @@ public partial class GameManager : MonoBehaviourSingleton<GameManager>
public double NeedNotificationThreshold => _needNotificationThreshold;
public Character Player => _player;
/// <summary>
/// Die Transform des Spielers.
/// </summary>

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 088e8b34c7ef472e9cea312c5f180215
timeCreated: 1712426151

View File

@ -0,0 +1,12 @@
using UnityEngine;
namespace Interaction
{
public class Copier : MonoBehaviour
{
public void Copy()
{
Debug.Log("Kopierer erfolgreich benutzt!");
}
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: cc147cbb4aa44e209ac96e08e57cab11
timeCreated: 1712427562

View File

@ -0,0 +1,18 @@
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.Serialization;
namespace Interaction
{
public class GiveItemInteractible : Interactible
{
[SerializeField] private Developer _developer;
/// <summary>
/// Der Entwickler an den das Item übergeben wird.
/// </summary>
public Developer Developer => _developer;
public override bool IsBlocked() => !GameManager.Instance.Player.CarriesItem;
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 8c62dfbaefa34afca6b4a8378b9c9083
timeCreated: 1712427286

View File

@ -0,0 +1,50 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Unity.VisualScripting;
using UnityEngine;
using UnityEngine.Events;
using Utility;
namespace Interaction
{
public enum InteractibleType
{
Pickup,
Use,
Give
}
public abstract class Interactible : MonoBehaviour
{
[SerializeField]
private Outline _outline;
[SerializeField]
private Color _selectedColor = Color.white;
[SerializeField]
private Color _highlightColor = Color.yellow;
public void Highlight(bool hightlight)
{
_outline.enabled = hightlight;
_outline.OutlineColor = _highlightColor;
_outline.OutlineWidth = 2;
}
public void SetSelected(bool isSelected)
{
Highlight(true);
if (isSelected)
{
_outline.OutlineColor = _selectedColor;
_outline.OutlineWidth = 4;
}
}
public virtual bool IsBlocked()
{
return false;
}
}
}

View File

@ -0,0 +1,18 @@
using UnityEngine;
namespace Interaction
{
public class PickupInteractible : Interactible
{
[SerializeField]
private GameObject _model;
[SerializeField]
private string _name;
public GameObject Model => _model;
public string Name => _name;
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 4cae243dedd2499e8326b9ed6de6e32e
timeCreated: 1712426173

View File

@ -0,0 +1,12 @@
using UnityEngine.Events;
using UnityEngine.Serialization;
namespace Interaction
{
public class UseInteractible : Interactible
{
[FormerlySerializedAs("Text")] public string UseText;
public UnityEvent OnUse;
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 18452aa2b74a4b10aaed4635c1080c90
timeCreated: 1712426953

View File

@ -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;
}
}

View File

@ -0,0 +1,13 @@
using System.Collections.Generic;
using UnityEngine;
namespace Utility
{
public static class IReadonlyListExtension
{
public static T GetRandomElement<T>(this IReadOnlyList<T> list)
{
return list[Random.Range(0, list.Count)];
}
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: a37950394de44b8db5d8de3e9fd574a6
timeCreated: 1712430620