Skip to content

Commit

Permalink
Bug fix: preserve and restore LongKui's last known mode after scene load
Browse files Browse the repository at this point in the history
Bug fix: preserve and restore LongKui's last known mode after scene load
  • Loading branch information
0x7c13 committed Mar 29, 2022
1 parent 1d54e6d commit bc31e1b
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion Assets/Scripts/Pal3/Player/PlayerManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,13 @@ public class PlayerManager :
ICommandExecutor<ActorFadeOutCommand>,
ICommandExecutor<PlayerEnableInputCommand>,
ICommandExecutor<CameraFocusOnActorCommand>,
ICommandExecutor<ScenePostLoadingNotification>
ICommandExecutor<ScenePostLoadingNotification>,
ICommandExecutor<LongKuiSwitchModeCommand>
{
private PlayerActorId _playerActor = 0;
private bool _playerActorControlEnabled;
private bool _playerInputEnabled;
private int _longKuiLastKnownMode = 0;

public PlayerManager()
{
Expand Down Expand Up @@ -278,6 +280,11 @@ public void Execute(CameraFocusOnActorCommand command)
}
}

public void Execute(LongKuiSwitchModeCommand command)
{
_longKuiLastKnownMode = command.Mode;
}

public void Execute(ScenePostLoadingNotification notification)
{
CommandDispatcher<ICommand>.Instance.Dispatch(new ActorActivateCommand((int)_playerActor, 1));
Expand All @@ -291,6 +298,8 @@ public void Execute(ScenePostLoadingNotification notification)
{
CommandDispatcher<ICommand>.Instance.Dispatch(new PlayerEnableInputCommand(1));
}

CommandDispatcher<ICommand>.Instance.Dispatch(new LongKuiSwitchModeCommand(_longKuiLastKnownMode));
}
}
}

0 comments on commit bc31e1b

Please sign in to comment.