This means when there are no other commands to execute, CurrentCommandIndex = PerformedCommandActionsCount - 1. Calling ClearCommandQueue() will then reset the CurrentCommandIndex to 0 which is the correct initial value.CurrentCommandIndex[get]
Returns the current command action index being processed. If this equals to PerformedCommandActionsCount then no more command actions are queued
Current behavior:
Code: Select all
player.SetInputEnabled(false);
// CurrentCommandIndex: -1, PerformedCommandCount: 0
player.AddCommand(new PlayerCommand(PlayerCommandType.StartCrouch));
// CurrentCommandIndex: 0, PerformedCommandCount: 1
player.AddCommand(new PlayerCommand(PlayerCommandType.Grab));
// CurrentCommandIndex: 1, PerformedCommandCount: 2
Code: Select all
player.SetInputEnabled(false);
player.ClearCommandQueue();
// CurrentCommandIndex: 0, PerformedCommandCount: 0
player.AddCommand(new PlayerCommand(PlayerCommandType.StartCrouch));
// CurrentCommandIndex: 1, PerformedCommandCount: 1
player.AddCommand(new PlayerCommand(PlayerCommandType.Grab));
// CurrentCommandIndex: 2, PerformedCommandCount: 2