Unity-Design-Pattern
Unity-Design-Pattern copied to clipboard
Behavioral Patterns ----Command Pattern-----Example3
这个例子写的有Bug 一旦UnDo后 进行新的命令就就会出现Bug 原因是UnDo后 再进行Command 没有清除之前的Comand
可以把添加命令代码改为
MoveCommand moveCommand = new MoveCommand(moveCommandReciever, direction, moveDistance, objectToMove);
moveCommand.Execute();
commands.Insert(currentCommandNum,moveCommand);
currentCommandNum++;
while (commands.Count>currentCommandNum)
{
commands.RemoveAt(commands.Count - 1);
}
大佬,快回来改bug了