Decision WORKS YAY
This commit is contained in:
1 parent
739d1f0374
commit
ccc4c04234
177 files changed
+208565
-120026
No files matched your search
@@ -2,6 +2,7 @@ using System.Threading;
|
||||
using Code.Game.Gameplay.Player;
|
||||
using Code.Infrastructure.Camera;
|
||||
using Code.Infrastructure.Input;
|
||||
using Code.OfficeGame.BattleMode.UI;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using Reflex.Attributes;
|
||||
using UnityEngine;
|
||||
@@ -10,6 +11,8 @@ namespace Code.OfficeGame.BattleMode.Actions.Player
|
||||
{
|
||||
public class PlayerTimelineActor : EntityTimelineActor
|
||||
{
|
||||
[Inject] private BattleActionDecisionPanel _battleActionDecisionPanel;
|
||||
|
||||
[Inject]
|
||||
private void Construct(
|
||||
CameraStateMachine cameraStateMachine,
|
||||
@@ -17,20 +20,41 @@ namespace Code.OfficeGame.BattleMode.Actions.Player
|
||||
PlayerMovementController playerMovementController)
|
||||
{
|
||||
BattleActions.Add(BattleActionType.Wait, new BattleActionWait());
|
||||
BattleActions.Add(BattleActionType.Move, new BattleActionMove(cameraStateMachine, inputService, playerMovementController));
|
||||
BattleActions.Add(BattleActionType.Move,
|
||||
new BattleActionMove(cameraStateMachine, inputService, playerMovementController));
|
||||
}
|
||||
|
||||
public override async UniTask DecideAction(CancellationToken ct)
|
||||
public override async UniTask DecideAction(CancellationToken ctx)
|
||||
{
|
||||
bool succeded = false;
|
||||
BattleActionDecisionResultCode decision = BattleActionDecisionResultCode.Deciding;
|
||||
|
||||
var decidedAction = BattleActionType.Move; // T
|
||||
_battleActionDecisionPanel.SetEntityInfo(BattleActions);
|
||||
|
||||
while (!succeded || ct.IsCancellationRequested)
|
||||
BattleActionType decidedAction = BattleActionType.None;
|
||||
|
||||
while (decidedAction == BattleActionType.None || ctx.IsCancellationRequested)
|
||||
{
|
||||
Debug.Log("player decided to move");
|
||||
Cursor.lockState = CursorLockMode.Confined;
|
||||
|
||||
await _battleActionDecisionPanel.Open(ctx);
|
||||
|
||||
succeded = await BattleActions[decidedAction].DecideAction();
|
||||
decidedAction = await _battleActionDecisionPanel.GetDecision(ctx);
|
||||
|
||||
while (decidedAction != BattleActionType.None
|
||||
&& decision == BattleActionDecisionResultCode.Deciding
|
||||
&& !ctx.IsCancellationRequested)
|
||||
{
|
||||
Cursor.lockState = CursorLockMode.Locked;
|
||||
|
||||
await _battleActionDecisionPanel.Close(ctx);
|
||||
|
||||
// Панель UI здесь
|
||||
|
||||
decision = await BattleActions[decidedAction].DecideAction();
|
||||
|
||||
if (decision == BattleActionDecisionResultCode.CancelDecision)
|
||||
decidedAction = BattleActionType.None;
|
||||
}
|
||||
}
|
||||
|
||||
CurrentAction = BattleActions[decidedAction];
|
||||
|
||||
Reference in new issue
Block a user