Beispiel #1
0
    public void OnFinishTask(object msg)
    {
        int taskType = (int)msg;

        Debug.Log($"Finish Task{taskType}!!");

        HealthUI.ShowFor(ShowDurOnFinishTask);

        MilkUI.OnStop();
        ToyUI.OnStop();
    }
Beispiel #2
0
    void Update()
    {
        int itemid   = GetComponent <SceneItem>().id;
        int babyStat = BabySmileManager.GetItemState(itemid);

        if (babyStat == 1)
        {
            //平静
            acumTime += Time.deltaTime;
            if (acumTime > cryTh)
            {
                //提需求,开始哭
                acumTime = 0;
                cryTh    = Random.Range(minTime, maxTime);

                int taskType = Random.Range(1, taskNum + 1);

                if (m_state == State.FirstTask)
                {
                    taskType = 2;
                    m_state  = State.SecondTask;
                    FirstTutorial.ShowFor(8f);
                }
                else if (m_state == State.SecondTask)
                {
                    taskType = 1;
                    m_state  = State.RandomTask;
                    SecondTutorial.ShowFor(8f);
                }
                else if (m_state == State.RandomTask)
                {
                    // do nothing
                }

                BabySmileManager.AddTask(taskType);
                BabySmileManager.SetItemState(itemid, 2);

                OnStartTask(taskType);
                SceneControl.Instance.InteractItems[itemid].GetComponent <SceneItem>().Status = 2;
            }
        }
        else
        {
            //婴儿在哭
            cryTime += Time.deltaTime;
            if (cryTime > hurtTh)
            {
                cryTime = 0;
                BabySmileManager.ChangeHealth(-1);
                //表现层健康条减小
            }
        }
    }