implement simple learning process
This commit is contained in:
@@ -3,10 +3,10 @@
|
|||||||
public enum JobPositions { Unemployed, Cashier, Clerk, ManagerAssistaint, Manager };
|
public enum JobPositions { Unemployed, Cashier, Clerk, ManagerAssistaint, Manager };
|
||||||
public enum EducationSkill { NotEducated, School, HightSchool, University };
|
public enum EducationSkill { NotEducated, School, HightSchool, University };
|
||||||
public enum PlayerStates { Awake, Sleeping, Eating, Working }
|
public enum PlayerStates { Awake, Sleeping, Eating, Working }
|
||||||
public enum StatsId { Money, RentAccount, Food, Energy, BankAccount, Job,LocationName }
|
public enum StatsId { Money, RentAccount, Food, Energy, BankAccount, Job, LocationName }
|
||||||
public enum Tasks { Move, Interact, Rotate };
|
public enum Tasks { Move, Interact, Rotate };
|
||||||
public enum TaskStatus { Waiting, InProgress, Complete };
|
public enum TaskStatus { Waiting, InProgress, Complete };
|
||||||
public enum InteractionStatus { None,Complete, WaitForChoose, InProgress, FarFromPlayer };
|
public enum InteractionStatus { None, Complete, WaitForChoose, InProgress, FarFromPlayer };
|
||||||
public enum AnimationStates
|
public enum AnimationStates
|
||||||
{
|
{
|
||||||
[EnumMember(Value = "Idle")]
|
[EnumMember(Value = "Idle")]
|
||||||
@@ -23,7 +23,8 @@ public enum AnimationStates
|
|||||||
Standing
|
Standing
|
||||||
};
|
};
|
||||||
|
|
||||||
public enum RadialMenuActions {
|
public enum RadialMenuActions
|
||||||
|
{
|
||||||
Cancel,
|
Cancel,
|
||||||
Sleep,
|
Sleep,
|
||||||
Eat,
|
Eat,
|
||||||
@@ -31,7 +32,8 @@ public enum RadialMenuActions {
|
|||||||
Take,
|
Take,
|
||||||
Work,
|
Work,
|
||||||
Talk,
|
Talk,
|
||||||
Buy ,
|
Buy,
|
||||||
Open,
|
Open,
|
||||||
Enter
|
Enter,
|
||||||
|
Learn,
|
||||||
}
|
}
|
||||||
@@ -28,6 +28,7 @@ public abstract class BaseInteractableObject : MonoBehaviour
|
|||||||
{ RadialMenuActions.Open, new RadialMenuActionDescription() { Description = "Open", IsEnabled = false } },
|
{ RadialMenuActions.Open, new RadialMenuActionDescription() { Description = "Open", IsEnabled = false } },
|
||||||
{ RadialMenuActions.Enter, new RadialMenuActionDescription() { Description = "Enter", IsEnabled = false } },
|
{ RadialMenuActions.Enter, new RadialMenuActionDescription() { Description = "Enter", IsEnabled = false } },
|
||||||
{ RadialMenuActions.Cancel, new RadialMenuActionDescription() { Description = "Cancel", IsEnabled = true } },
|
{ RadialMenuActions.Cancel, new RadialMenuActionDescription() { Description = "Cancel", IsEnabled = true } },
|
||||||
|
{ RadialMenuActions.Learn, new RadialMenuActionDescription() { Description = "Learn", IsEnabled = false} },
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -12,7 +12,7 @@ public class OfficeTable : BaseInteractableObject
|
|||||||
|
|
||||||
protected override void InteractAction(RadialMenuActions interactAction)
|
protected override void InteractAction(RadialMenuActions interactAction)
|
||||||
{
|
{
|
||||||
GameManager.Instance.UI.ShowTabObtionsDialog(_dialogSO, null, OnConfirm);
|
GameManager.Instance.UI.ShowTabOptionsDialog(_dialogSO, null, OnConfirm);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnConfirm(IDialogOption selectedJob)
|
private void OnConfirm(IDialogOption selectedJob)
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
using Assets.Scripts.Interfaces;
|
||||||
|
using System;
|
||||||
|
using Unity.VisualScripting;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public class SecretaryDesk : BaseInteractableObject
|
||||||
|
{
|
||||||
|
[SerializeField]
|
||||||
|
private DialogSO _dialogSO;
|
||||||
|
|
||||||
|
protected override void PrepareMenuActions()
|
||||||
|
{
|
||||||
|
_menuActions[RadialMenuActions.Talk].IsEnabled = true;
|
||||||
|
_menuActions[RadialMenuActions.Learn].IsEnabled = Player.Instance.ActiveCourse != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void InteractAction(RadialMenuActions interactAction)
|
||||||
|
{
|
||||||
|
switch (interactAction)
|
||||||
|
{
|
||||||
|
|
||||||
|
case RadialMenuActions.Talk:
|
||||||
|
GameManager.Instance.UI.ShowTabOptionsDialog(_dialogSO, null, OnConfirm);
|
||||||
|
break;
|
||||||
|
case RadialMenuActions.Learn:
|
||||||
|
GameManager.Instance.UI.ShowTimeSliderDialog("Learn", "learn until", OnCancel, OnLearnConfirm);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnLearnConfirm(TimeSpan time)
|
||||||
|
{
|
||||||
|
GameManager.Instance.Time.FastForward(time);
|
||||||
|
GameManager.Instance.Time.OnFastForwardEnd += OnFastForwardEnd;
|
||||||
|
_player.Learn(time);
|
||||||
|
}
|
||||||
|
private void OnCancel()
|
||||||
|
{
|
||||||
|
OnFastForwardEnd();
|
||||||
|
}
|
||||||
|
private void OnFastForwardEnd()
|
||||||
|
{
|
||||||
|
_player.SetPlayerActing(PlayerStates.Awake);
|
||||||
|
_player.SetPlayerAnimation(AnimationStates.Standing);
|
||||||
|
GameManager.Instance.Time.OnFastForwardEnd -= OnFastForwardEnd;
|
||||||
|
}
|
||||||
|
private void OnConfirm(IDialogOption selectedOption)
|
||||||
|
{
|
||||||
|
_player.ActiveCourse = (selectedOption as EducationInfoSO);
|
||||||
|
print($"player selected course is {(selectedOption as EducationInfoSO).Description}");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
using Assets.Scripts.Interfaces;
|
|
||||||
using UnityEngine;
|
|
||||||
|
|
||||||
public class SecretaryDesk : BaseInteractableObject
|
|
||||||
{
|
|
||||||
[SerializeField]
|
|
||||||
private DialogSO _dialogSO;
|
|
||||||
|
|
||||||
protected override void PrepareMenuActions()
|
|
||||||
{
|
|
||||||
_menuActions[RadialMenuActions.Talk].IsEnabled = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void InteractAction(RadialMenuActions interactAction)
|
|
||||||
{
|
|
||||||
GameManager.Instance.UI.ShowTabObtionsDialog(_dialogSO, null, OnConfirm);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnConfirm(IDialogOption selectedOption)
|
|
||||||
{
|
|
||||||
//_player.JobPosition = (selectedOption as EducationInfoSO).JobPosition;
|
|
||||||
print($"player selected position is {(selectedOption as EducationInfoSO).Description}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 64bc13a0b6923c14ab5d87e8338aca0c
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -16,6 +16,8 @@ public class Player : BaseCharacter
|
|||||||
public Dictionary<StatsId, object> Stats;
|
public Dictionary<StatsId, object> Stats;
|
||||||
public JobPositions JobPosition { get; set; }
|
public JobPositions JobPosition { get; set; }
|
||||||
|
|
||||||
|
private List<EducationInfoSO> _completedCourses=new();
|
||||||
|
public EducationInfoSO ActiveCourse { get; set; }
|
||||||
public EducationSkill Education { get; set; }
|
public EducationSkill Education { get; set; }
|
||||||
|
|
||||||
private ContainerItem _containerItem;
|
private ContainerItem _containerItem;
|
||||||
@@ -148,4 +150,15 @@ public class Player : BaseCharacter
|
|||||||
{
|
{
|
||||||
return _locationName;
|
return _locationName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal void Learn(TimeSpan time)
|
||||||
|
{
|
||||||
|
ActiveCourse.PlayerProgress+= time.Hours;
|
||||||
|
if(ActiveCourse.PlayerProgress>=ActiveCourse.Duration)
|
||||||
|
{
|
||||||
|
Education++;
|
||||||
|
print($"Congratulation player finish curse {ActiveCourse.Description} and his education now {Education.ToString()}");
|
||||||
|
ActiveCourse =null;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,4 +8,5 @@ public class EducationInfoSO : IDialogOption
|
|||||||
public int Duration;
|
public int Duration;
|
||||||
public float EnrollPrice;
|
public float EnrollPrice;
|
||||||
public EducationSkill Skill;
|
public EducationSkill Skill;
|
||||||
|
public int PlayerProgress;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ public class UISystem : MonoBehaviour
|
|||||||
timeSlider.ShowTimeSliderDialog(title, description, onCancel, onConfirm);
|
timeSlider.ShowTimeSliderDialog(title, description, onCancel, onConfirm);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ShowTabObtionsDialog(DialogSO dialogSO, Action onCancel, Action<IDialogOption> onConfirm)
|
public void ShowTabOptionsDialog(DialogSO dialogSO, Action onCancel, Action<IDialogOption> onConfirm)
|
||||||
{
|
{
|
||||||
var dialog = Instantiate(_DialogUIPrefab, transform);
|
var dialog = Instantiate(_DialogUIPrefab, transform);
|
||||||
dialog.ShowCategoriesDialog(dialogSO, onCancel, onConfirm);
|
dialog.ShowCategoriesDialog(dialogSO, onCancel, onConfirm);
|
||||||
|
|||||||
Reference in New Issue
Block a user