implement simple learning process
This commit is contained in:
@@ -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}");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user