Implement player education parameter
Enable job offer according to Player education
This commit is contained in:
@@ -189,6 +189,7 @@ MonoBehaviour:
|
||||
_descreiption: {fileID: 3870220567668916177}
|
||||
_sallary: {fileID: 2787096983671346797}
|
||||
_icon: {fileID: 5333122869086954718}
|
||||
_button: {fileID: 7544413826500446465}
|
||||
--- !u!114 &9018781955098760075
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
public enum JobPositions { Unemployed,Cashier, Clerk, ManagerAssistaint, Manager };
|
||||
public enum EducationSkill { NotEducated, School, HightSchool,University};
|
||||
|
||||
public enum PlayerStates { Awake, Sleeping, Eating,Working }
|
||||
public enum StatsId { Money, RentAccount, Food, Energy, BankAccount, Job, }
|
||||
public enum Tasks { Move, Interact, Rotate };
|
||||
|
||||
@@ -24,6 +24,8 @@ public class Player : MonoBehaviour
|
||||
public Dictionary<StatsId, Stat> Stats;
|
||||
public JobPositions JobPosition { get; set; }
|
||||
|
||||
public EducationSkill Education { get; set; }
|
||||
|
||||
private readonly Queue<PlayerTasks> _tasks = new Queue<PlayerTasks>();
|
||||
private PlayerTasks _currentTask;
|
||||
|
||||
|
||||
@@ -7,4 +7,5 @@ public class JobInfoSO : ScriptableObject
|
||||
public float Salary;
|
||||
public Sprite Icon;
|
||||
public JobPositions JobPosition;
|
||||
public EducationSkill MinimumEducationSkill;
|
||||
}
|
||||
|
||||
@@ -16,3 +16,4 @@ MonoBehaviour:
|
||||
Salary: 5
|
||||
Icon: {fileID: 0}
|
||||
JobPosition: 2
|
||||
MinimumEducationSkill: 1
|
||||
|
||||
@@ -16,3 +16,4 @@ MonoBehaviour:
|
||||
Salary: 9
|
||||
Icon: {fileID: 0}
|
||||
JobPosition: 4
|
||||
MinimumEducationSkill: 3
|
||||
|
||||
@@ -16,3 +16,4 @@ MonoBehaviour:
|
||||
Salary: 6
|
||||
Icon: {fileID: 0}
|
||||
JobPosition: 3
|
||||
MinimumEducationSkill: 2
|
||||
|
||||
@@ -3,7 +3,7 @@ using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class JobItemUITemplate : MonoBehaviour, IPointerClickHandler, IPointerEnterHandler
|
||||
public class JobItemUITemplate : MonoBehaviour, IPointerEnterHandler
|
||||
{
|
||||
[SerializeField]
|
||||
private TextMeshProUGUI _descreiption;
|
||||
@@ -12,6 +12,9 @@ public class JobItemUITemplate : MonoBehaviour, IPointerClickHandler, IPointerE
|
||||
[SerializeField]
|
||||
private Image _icon;
|
||||
|
||||
[SerializeField]
|
||||
private Button _button;
|
||||
|
||||
private JobSelectorUI _parent;
|
||||
private JobInfoSO _item;
|
||||
public JobInfoSO Item=> _item;
|
||||
@@ -23,23 +26,20 @@ public class JobItemUITemplate : MonoBehaviour, IPointerClickHandler, IPointerE
|
||||
_descreiption.text = item.Description;
|
||||
_sallary.text = $"{item.Salary}$";
|
||||
_icon.sprite = item.Icon;
|
||||
_button.enabled = Player.Instance.Education>=item.MinimumEducationSkill;
|
||||
}
|
||||
|
||||
void OnMouseDown()
|
||||
{
|
||||
_parent.OnItemSelected(this);
|
||||
}
|
||||
public void OnPointerClick(PointerEventData eventData)
|
||||
{
|
||||
_parent.OnItemSelected(this);
|
||||
}
|
||||
|
||||
|
||||
public void Click()
|
||||
{
|
||||
_parent.OnItemSelected(this);
|
||||
if (_button.enabled)
|
||||
{
|
||||
_parent.OnItemSelected(this);
|
||||
}
|
||||
}
|
||||
|
||||
public void OnPointerEnter(PointerEventData eventData)
|
||||
{
|
||||
if (!_button.enabled) { print("Not enough education"); }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using TMPro;
|
||||
using Unity.VisualScripting;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.UI;
|
||||
|
||||
Reference in New Issue
Block a user