Snake

Use the command pattern to create snake-like following mechanic between capsules. Snake-like movement means that the head of the snake will decide where to move and the following capsules, will follow the same steps. This is a creative exercise, so there are no precise guidelines, only a few requirements.

Requirements:

  • The snake must be at least 4 parts long.
  • The following must be done through execution of MoveCommands created in task 1.
  • All parts of the snake must have an identical GridMovement attached. The idea is that there is no difference in movement logic for the head and the tail.
  • GridMovement script must move only the part of the snake it is attached to.
  • Switch command has to continue working.
  • There can be multiple snakes present in the scene.
  • The switch command should switch between only the heads of different snakes.
  • This solution does not have to work with Undo. If you completed both tasks in reasonable time though, then it is recommended to try to make them work together. Depending on your solutions, this part may be quite difficult.
;