implement simple learning process

This commit is contained in:
Vova
2023-12-19 19:22:26 +02:00
parent 22149e24c8
commit 0f60b41d58
11 changed files with 84 additions and 31 deletions
@@ -28,6 +28,7 @@ public abstract class BaseInteractableObject : MonoBehaviour
{ RadialMenuActions.Open, new RadialMenuActionDescription() { Description = "Open", IsEnabled = false } },
{ RadialMenuActions.Enter, new RadialMenuActionDescription() { Description = "Enter", IsEnabled = false } },
{ RadialMenuActions.Cancel, new RadialMenuActionDescription() { Description = "Cancel", IsEnabled = true } },
{ RadialMenuActions.Learn, new RadialMenuActionDescription() { Description = "Learn", IsEnabled = false} },
};
}
@@ -12,7 +12,7 @@ public class OfficeTable : BaseInteractableObject
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)
@@ -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}");
}
}