Unity2d 提示对话框的智能化显示

提示框主体

智能提示的应用场景:

任务完成、角色死亡、子弹不足、游戏超时

一、任务完成

二、角色死亡

 

 

三、子弹不足

四、游戏超时

代码

    public void tip()
    {
        //tiptimer = tiptime;

        if(showflag==1)
        {
            int index = SceneManager.GetActiveScene().buildIndex;
            if(index==1)
            {
                tipsframe.SetActive(true);
                tips.text = "Tips:\n快前往城堡,进行下一关吧!";
            }
            else if(index==2)
            {
                tipsframe.SetActive(true);
                tips.text = "Tips:\n亲亲、你已经通关了,请五星好评哦!";
            }
        }
        else if(currentHealth==0)
        {
            tipsframe.SetActive(true);
            int index = SceneManager.GetActiveScene().buildIndex;
            if(index==1)
            {
                tips.text = "Tips:\n该长教训了吧,哈哈!";
            }
            else if(index==2 && RobotControl.isFixed%2==1)
            {
                tips.text = "Tips:\n机器人被激怒,会主动攻击人哦。尝试着对它连续完成两次攻击吧!";
            }
            else if (index == 2 && RobotControl.isFixed % 2 != 1)
            {
                tips.text = "Tips:\n你可长点教训吧,哈哈!";
            }
            else
            {
                return;
            }
        }
        else if(curBulletCount==0 && currentHealth!=0)
        {
            tipsframe.SetActive(true);
            tips.text = "Tips:\n没有子弹了,快去拾取子弹吧!";
        }
        else if(gametime>180)
        {
            tipsframe.SetActive(true);
            tips.text = "Tips:\n游戏超时了哦";
        }
    }

附完整教程:

Unity2d Rubys Adventure 课程设计报告

  • 1
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值