Interaktionen 2.0
This commit is contained in:
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user