refactor interact system

interact only after PopupItemMenu button clicked
This commit is contained in:
Vova
2023-11-16 16:11:39 +02:00
parent c2bb35a46d
commit 1774ab5b18
12 changed files with 100 additions and 61 deletions
@@ -11,16 +11,15 @@ public class CashierDesk : BaseInteractableObject
private List<JobInfoSO> _jobsInfoList;
private JobInfoSO _playerJob;
public override void Interact(Player player)
protected override void InteractAction()
{
base.Interact(player);
if (player.IsHoldContainerItem())
if (_player.IsHoldContainerItem())
{
BuyItems();
}
else
{
_playerJob = _jobsInfoList.Where(x => x.JobPosition == player.JobPosition).FirstOrDefault();
_playerJob = _jobsInfoList.Where(x => x.JobPosition == _player.JobPosition).FirstOrDefault();
print($"playerJob is {_playerJob}");
if (_playerJob != null)
{
@@ -31,7 +30,7 @@ public class CashierDesk : BaseInteractableObject
{
print("You don't work here");
}
}
}
}
private void BuyItems()