Pickup Pizza und so
This commit is contained in:
41
3d Prototyp/Assets/Pickupable.cs
Normal file
41
3d Prototyp/Assets/Pickupable.cs
Normal file
@ -0,0 +1,41 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user