需要修改的变量均设置为 public static 类型

    public void DeveloperAdjust()
    {
        if (devflag == false)
        {
            devtext.text = "调试:开";
            PlayerControl.maxBulletCount = 999;
            PlayerControl.curBulletCount = 999;
            PlayerControl.maxHealth = 999;
            PlayerControl.currentHealth = 999;
            PlayerControl.speed = 6f;
            devflag = true;
            return;
        }
        if (devflag == true)
        {
            devtext.text = "调试:关";
            PlayerControl.maxBulletCount = 6;
            PlayerControl.curBulletCount = 2;
            PlayerControl.maxHealth = 2;
            PlayerControl.currentHealth = 2;
            PlayerControl.speed = 3f;
            UpdateHealthBar(2, 2);
            UpdateBulletCount(2, 6);
            devflag = false;
            return;
        }
    }

附完整教程:

Unity2d Rubys Adventure 课程设计报告

posted on 2020-06-11 00:54  海月CSDN  阅读(262)  评论(0编辑  收藏  举报