Player can select job position now
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
|
||||
public class CashierDesk : BaseInteractableObject
|
||||
@@ -6,8 +8,8 @@ public class CashierDesk : BaseInteractableObject
|
||||
[SerializeField]
|
||||
private ContainerSO _containerSO;
|
||||
[SerializeField]
|
||||
private JobInfoSO _jobInfo;
|
||||
|
||||
private List<JobInfoSO> _jobsInfoList;
|
||||
private JobInfoSO _playerJob;
|
||||
|
||||
public override void Interact(Player player)
|
||||
{
|
||||
@@ -18,11 +20,12 @@ public class CashierDesk : BaseInteractableObject
|
||||
}
|
||||
else
|
||||
{
|
||||
// if player work here
|
||||
if (player.JobPosition == _jobInfo.JobPosition)
|
||||
_playerJob = _jobsInfoList.First(x => x.JobPosition == player.JobPosition);
|
||||
print($"playerJob is {_playerJob}");
|
||||
if (_playerJob != null)
|
||||
{
|
||||
UIManager.Instance.ShowTimeSliderDialog($"Work", $"Work as {_jobInfo.Description}", OnCancel, OnConfirm);
|
||||
|
||||
UIManager.Instance.ShowTimeSliderDialog($"Work", $"Work as {_playerJob.Description}", OnCancel, OnConfirm);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -72,7 +75,7 @@ public class CashierDesk : BaseInteractableObject
|
||||
float _totalSalary;
|
||||
private void OnConfirm(TimeSpan time)
|
||||
{
|
||||
_totalSalary = (float)(time.TotalHours * _jobInfo.Salary);
|
||||
_totalSalary = (float)(time.TotalHours * _playerJob.Salary);
|
||||
_player.SetPlayerActing(PlayerStates.Working);
|
||||
TimeManager.Instance.FastForward(time);
|
||||
TimeManager.Instance.OnFastForwardEnd += OnFastForwardEnd;
|
||||
|
||||
@@ -13,8 +13,9 @@ public class OfficeTable : BaseInteractableObject
|
||||
UIManager.Instance.ShowJobSelectionDialog("Job agency", null, OnConfirm);
|
||||
}
|
||||
|
||||
private void OnConfirm()
|
||||
private void OnConfirm(JobInfoSO selectedJob)
|
||||
{
|
||||
_player.JobPosition = JobPositions.Clerk;
|
||||
_player.JobPosition = selectedJob.JobPosition;
|
||||
print($"player selected position is {_player.JobPosition}");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user