Пример #1
0
    void Update()
    {
        //花盆状态 生苗1枯苗2生花3枯花4成花5
        int itemid     = GetComponent <SceneItem>().id;
        int flowerStat = BabySmileManager.GetItemState(itemid);
        int placeid    = BabySmileManager.GetTableType(BabySmileManager.GetItemTableID(itemid));

        /*
         * if (flowerStat == 2 || flowerStat == 4 || flowerStat == 5)
         * {
         *  //枯苗和枯花和成花都是锁定在阳台上不可拾取的,只能对其进行浇水或者采摘操作
         *  //BabySmileManager.SetPickable(itemid, false);
         * }*/
        if (placeid == 3 && (flowerStat == 1 || flowerStat == 3))
        {
            //生苗和生花可以拾取,但只有在阳台才会生长
            acumTime += Time.deltaTime;
            if (acumTime > waterTime)
            {
                acumTime = 0;
                //BabySmileManager.SetPickable(itemid, true);
                BabySmileManager.SetItemState(itemid, flowerStat + 1);
                //表现层改状态为枯苗/枯花
                SceneControl.Instance.InteractItems[itemid].GetComponent <SceneItem>().Status = flowerStat + 1;
            }
        }
    }
Пример #2
0
    void Update()
    {
        int itemid = GetComponent <SceneItem>().id;
        int pcStat = BabySmileManager.GetItemState(itemid);

        if (pcStat == 1)
        {
            //随机产生邮件
            acumTime += Time.deltaTime;
            waitTime  = 0;
            if (acumTime > jobTh)
            {
                acumTime = 0;
                jobTh    = Random.Range(minTime, maxTime);
                BabySmileManager.SetItemState(itemid, 2);
                //表现层改状态为邮件
                SceneControl.Instance.InteractItems[itemid].GetComponent <SceneItem>().Status = 2;
                OnShowJob();
            }
        }
        else if (pcStat == 2)
        {
            //长时间没人理会变成关机
            waitTime += Time.deltaTime;
            if (waitTime > waitTh)
            {
                waitTime = 0;
                BabySmileManager.SetItemState(itemid, 1);
                //表现层改状态为关机

                SceneControl.Instance.InteractItems[itemid].GetComponent <SceneItem>().Status = 1;
                OnEndJob();
            }
        }
    }
Пример #3
0
    void Start()
    {
        //游戏开始就要有个工作出现
        int itemid = GetComponent <SceneItem>().id;

        jobTh = Random.Range(minTime, maxTime);
        BabySmileManager.SetItemState(itemid, 2);
        //表现层改状态为邮件
        SceneControl.Instance.InteractItems[itemid].GetComponent <SceneItem>().Status = 2;
    }
Пример #4
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);
                //表现层健康条减小
            }
        }
    }
Пример #5
0
    void Update()
    {
        int itemid = GetComponent <SceneItem>().id;

        if (price > BabySmileManager.GetMoney())
        {
            BabySmileManager.SetItemState(itemid, 1);
            //表现层改状态为缺货
            GetComponent <SceneItem>().Status = 1;
        }
        else
        {
            BabySmileManager.SetItemState(itemid, 2);
            //表现层改状态为有货
            GetComponent <SceneItem>().Status = 2;
        }
    }