Work on item actions popup menu (like work, buy, etc)
This commit is contained in:
@@ -5,10 +5,17 @@ public class BaseInteractableObject : MonoBehaviour
|
||||
{
|
||||
[SerializeField]
|
||||
public Transform _interactionPoint;
|
||||
[SerializeField]
|
||||
public PopupItemMenu _radialMenuPrefab;
|
||||
|
||||
protected Player _player;
|
||||
public virtual void Interact(Player player)
|
||||
{
|
||||
_player=player;
|
||||
}
|
||||
|
||||
public void SpawnMenu()
|
||||
{
|
||||
UIManager.Instance.ShowItemsMenu();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,15 +103,18 @@ public class Player : MonoBehaviour
|
||||
_currentTask.UpdateStatus(MoveToPoint());
|
||||
break;
|
||||
case Tasks.Interact:
|
||||
if (IsPathComplete(_currentTask.TagretObject._interactionPoint.position))
|
||||
_currentTask.UpdateStatus(InteractWithObject(_currentTask.TagretObject));
|
||||
else
|
||||
{
|
||||
AddTask(new PlayerTasks(Tasks.Move, _currentTask.TagretObject));
|
||||
AddTask(new PlayerTasks(Tasks.Rotate, _currentTask.TagretObject));
|
||||
AddTask(_currentTask);
|
||||
_currentTask = null;
|
||||
}
|
||||
// Show interaction menu
|
||||
_currentTask.TagretObject.SpawnMenu();
|
||||
_currentTask = null;
|
||||
//if (IsPathComplete(_currentTask.TagretObject._interactionPoint.position))
|
||||
// _currentTask.UpdateStatus(InteractWithObject(_currentTask.TagretObject));
|
||||
//else
|
||||
//{
|
||||
// AddTask(new PlayerTasks(Tasks.Move, _currentTask.TagretObject));
|
||||
// AddTask(new PlayerTasks(Tasks.Rotate, _currentTask.TagretObject));
|
||||
// AddTask(_currentTask);
|
||||
// _currentTask = null;
|
||||
//}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class PopupItemMenu : MonoBehaviour
|
||||
{
|
||||
[SerializeField]
|
||||
private Button _popupMenuItemButtonPrefab;
|
||||
|
||||
public void ShowButtons()
|
||||
{
|
||||
var button=Instantiate(_popupMenuItemButtonPrefab) as Button;
|
||||
button.transform.SetParent(transform,false);
|
||||
button.transform.localPosition = new Vector3(0, 100f, 0);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0dea2e9a092ecf643963bb697b9963ca
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -4,11 +4,13 @@ using UnityEngine;
|
||||
public class UIManager : MonoBehaviour
|
||||
{
|
||||
[SerializeField]
|
||||
public TimeSliderUI _timeSliderPrefab;
|
||||
private TimeSliderUI _timeSliderPrefab;
|
||||
[SerializeField]
|
||||
public JobSelectorUI _jobSelectorPrefab;
|
||||
private JobSelectorUI _jobSelectorPrefab;
|
||||
[SerializeField]
|
||||
public GameObject _blurOverlay;
|
||||
private GameObject _blurOverlay;
|
||||
[SerializeField]
|
||||
private PopupItemMenu _itemPopupMenuPrefab;
|
||||
|
||||
public static UIManager Instance { get; private set; }
|
||||
|
||||
@@ -38,7 +40,13 @@ public class UIManager : MonoBehaviour
|
||||
jobSelector.ShowJobSelectionDialog(title, onCancel, onConfirm);
|
||||
}
|
||||
|
||||
|
||||
public void ShowItemsMenu()
|
||||
{
|
||||
var popupMenu = Instantiate(_itemPopupMenuPrefab) as PopupItemMenu;
|
||||
popupMenu.transform.transform.SetParent(transform, false);
|
||||
popupMenu.transform.position = Input.mousePosition;
|
||||
popupMenu.ShowButtons();
|
||||
}
|
||||
|
||||
public void Freeze()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user