游戏中的一个小玩法——挖矿

时间:2021-05-11   阅读次数:

    在开发的一个模拟经营类游戏时,想到的一个游戏小玩法,就是开局时,玩家可以挖矿快速金币的功能,也能解决其它产业在建造时无事可做时的补充。

    原来设计的挖矿功能,点击5秒左右,然后冷却15秒,如此反复循环。

void Update()
{
    nextemp += Time.deltaTime;
    if (nextemp > 5)
    {
        isClick = false;
        if (nextemp > 20)
        {
            nextemp = 0;
            isClick = true;
            if (PlayerManage.GuideIs)
            {
                GuidePanel.Instance.ShowGuide(GuideType.wakuang);   //新手
            }
         }else
        {
            //结算
            if (qianFin)
            {
                if (qianTemp > 0)
                {
                    PlayerManage.QianAdd(qianTemp);
                    UIZhangmuManage.ZhangmuAdd("挖矿", 1, qianTemp, 1,ZhangmuType.other);
                    UIRenwuManage.RenwuIngAdd(RenwuId.wakuang, qianTemp);
                        if (PlayerManage.GuideIs)
                        {
                            GuidePanel.Instance.FinshGuide(GuideType.wakuang);  //新手
                        }
                    }
                    qianTemp = 0;
                    qianFin = false;
                }
                float val = (20-nextemp)*1.0f / 15;
                timeSide.fillAmount = val;
            }
        }
        else
        {
            qianFin = true;
            float val = (nextemp) * 1.0f / 5;
            timeSide.fillAmount = val;
        }
        //点击间隔
        if (isClick)
        {
            if (isOn==false)
            {
                coltemp += Time.deltaTime;
                if (coltemp > coltime)
                {
                    coltemp = 0;
                    coltime = Random.Range(0.06f, 0.2f);
                    isOn = true;
                }
            }
        }
    }


上一篇:金钱数据动画

下一篇:Python股票刷新

其它文章