public void toDefaultNextState()
 {
     var lWay = state.defaultNextWay;
     lWay.action.impAction();
     state = lWay.destState;
 }
 public void tryToState(zzState pDestState)
 {
     if (state.defaultNextWay.destState == pDestState)
         toDefaultNextState();
 }
示例#3
0
    public void RunQ1toQ7()//打豆豆
    {
        switch (currentState)
        {
        case wupengState.wupengState_eat:
        {
            currentTime += Time.deltaTime;
            if (currentTime > 3.0f)
            {
                currentState = wupengState.wupengState_beat;
                currentTime  = 0.0f;
                Debug.Log("wupeng start to beat");
            }
        }
        break;

        case wupengState.wupengState_beat:
        {
            wupeng.energy = 100;
            currentTime  += Time.deltaTime;
            if (currentTime > 10.0f)
            {
                currentState = wupengState.wupengState_sleep;
                Debug.Log("wupeng start to sleep");
                Debug.Log("zz start to prepare");
                currentTime = 0.0f;
            }
        }
        break;


        case wupengState.wupengState_sleep:
        {
            currentTime += Time.deltaTime;

            switch (currentStatezz)

            {
            case zzState.zzState_prepare:
            {
                currentTime += Time.deltaTime;
                if (currentTime > 1.0f)
                {
                    currentStatezz = zzState.zzState_enrich;
                    Debug.Log("zz starts to enrich");
                }
            }
            break;

            case zzState.zzState_enrich:
            {
                currentTime += Time.deltaTime;
                if (currentTime > 3.0f)
                {
                    currentStatezz = zzState.zzState_dismantle;
                    Debug.Log("zz starts to dismantle");
                }
            }
            break;

            case zzState.zzState_dismantle:
            {
                currentTime += Time.deltaTime;
                if (currentTime > 4.0f)
                {
                    currentStatezz = zzState.zzState_stop;
                    Debug.Log("zz starts to stop");
                }
            }
            break;
            }

            if (currentTime > 5.0f)
            {
                currentState = wupengState.wupengState_eat;
                currentTime  = 0.0f;
                Debug.Log("wupeng start to eat");
            }
        }
        break;
        }
    }