using System.Threading; using Code.Game.Gameplay.Player; using Code.Infrastructure.Camera; using Code.Infrastructure.Input; using Cysharp.Threading.Tasks; using Reflex.Attributes; using UnityEngine; namespace Code.OfficeGame.BattleMode.Actions.Player { public class PlayerTimelineActor : EntityTimelineActor { [Inject] private void Construct( CameraStateMachine cameraStateMachine, IInputService inputService, PlayerMovementController playerMovementController) { BattleActions.Add(BattleActionType.Wait, new BattleActionWait()); BattleActions.Add(BattleActionType.Move, new BattleActionMove(cameraStateMachine, inputService, playerMovementController)); } public override async UniTask DecideAction(CancellationToken ct) { bool succeded = false; var decidedAction = BattleActionType.Move; // T while (!succeded || ct.IsCancellationRequested) { Debug.Log("player decided to move"); succeded = await BattleActions[decidedAction].DecideAction(); } CurrentAction = BattleActions[decidedAction]; } } }