Interaktionen 2.0
This commit is contained in:
12
3d Prototyp/Assets/Scripts/Interaction/Copier.cs
Normal file
12
3d Prototyp/Assets/Scripts/Interaction/Copier.cs
Normal file
@ -0,0 +1,12 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Interaction
|
||||
{
|
||||
public class Copier : MonoBehaviour
|
||||
{
|
||||
public void Copy()
|
||||
{
|
||||
Debug.Log("Kopierer erfolgreich benutzt!");
|
||||
}
|
||||
}
|
||||
}
|
||||
3
3d Prototyp/Assets/Scripts/Interaction/Copier.cs.meta
Normal file
3
3d Prototyp/Assets/Scripts/Interaction/Copier.cs.meta
Normal file
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cc147cbb4aa44e209ac96e08e57cab11
|
||||
timeCreated: 1712427562
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8c62dfbaefa34afca6b4a8378b9c9083
|
||||
timeCreated: 1712427286
|
||||
50
3d Prototyp/Assets/Scripts/Interaction/Interactible.cs
Normal file
50
3d Prototyp/Assets/Scripts/Interaction/Interactible.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
11
3d Prototyp/Assets/Scripts/Interaction/Interactible.cs.meta
Normal file
11
3d Prototyp/Assets/Scripts/Interaction/Interactible.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 36d05f0291670f94c9430f1f5e2604a8
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
18
3d Prototyp/Assets/Scripts/Interaction/PickupInteractible.cs
Normal file
18
3d Prototyp/Assets/Scripts/Interaction/PickupInteractible.cs
Normal 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;
|
||||
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4cae243dedd2499e8326b9ed6de6e32e
|
||||
timeCreated: 1712426173
|
||||
12
3d Prototyp/Assets/Scripts/Interaction/UseInteractible.cs
Normal file
12
3d Prototyp/Assets/Scripts/Interaction/UseInteractible.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 18452aa2b74a4b10aaed4635c1080c90
|
||||
timeCreated: 1712426953
|
||||
Reference in New Issue
Block a user