示例#1
0
 public void Handle(int args)
 {
     Debug.Log("ConcreteStateB.Handle" + args);
     if (args <= 10)
     {
         //转换状态A
         mContext.SetState(new ConcreteStateA(mContext));
     }
 }
示例#2
0
    void Start()
    {
        ConText context = new ConText();

        context.SetState(new ConcreteStateA(context));

        context.Handle(5);
        context.Handle(20);
        context.Handle(30);
        context.Handle(4);
    }