File tree Expand file tree Collapse file tree
Assets/Behavioral Patterns/State Pattern Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11# State Pattern 状态模式
2- ##Definition
2+ ## Definition
33
44Allow an object to alter its behavior when its internal state changes. The object will appear to change its class.
55<br >当一个对象内在状态改变时允许其改变行为,这个对象看起来像改变了其类。
66
77![ ] ( https://github.com/QianMo/Unity-Design-Pattern/blob/master/UML_Picture/state.gif )
88
99
10- ##Participants
10+ ## Participants
1111
1212The classes and objects participating in this pattern are:
1313
14- ###Context (Account)
14+ ### Context (Account)
1515* defines the interface of interest to clients
1616* maintains an instance of a ConcreteState subclass that defines the current state.
1717
18- ###State (State)
18+ ### State (State)
1919* defines an interface for encapsulating the behavior associated with a particular state of the Context.
2020
21- ###Concrete State (RedState, SilverState, GoldState)
21+ ### Concrete State (RedState, SilverState, GoldState)
2222* each subclass implements a behavior associated with a state of Context
2323
You can’t perform that action at this time.
0 commit comments