Changes

Jump to: navigation, search

State

1 byte added, 22:14, 22 March 2007
When do you use the State Pattern?
=== When do you use the State Pattern? ===
Suppose that you are playing War Craft. Your units will behave according to your commandcommands. For example, if the "Attack" command is given to your units, the state of the units will be changed to "Attack State" and they will attack the enemies around them. If you set them to hold their position, their state will be changed to "Hold Position" and your units will stop attacking and stand around. These behaviors such as "attack" behavior and "hold position" behavior can be also applied to other species – there are five species in this game; undeads, orcs, night elves, humans and corrupted night elves. By the use of the state pattern, it is possible to save time and gain reusability and maintainability since you do not have to code the similar unit behaviors all over again for other species when programming such game.
=== Advantages of using State Pattern ===
1
edit

Navigation menu