博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
自己写的连击文字特效
阅读量:5025 次
发布时间:2019-06-12

本文共 3205 字,大约阅读时间需要 10 分钟。

#region 处理连击文字特效    private float comboTimer=0.3f;    private int comboNumber=0;    private Coroutine comboCoroutine;    protected GameObject comboPrefab;    protected Transform[] comboNumberTransforms;    protected Transform comboNumberTransform;    protected SpriteRenderer[] comboNumberSprites;    protected SpriteRenderer comboHit;    protected Animator comboAnimator;    ///     /// 播放连击动画    ///     public void PlayComboEffect()    {        comboNumber += 1;        if (comboCoroutine != null)        {            StopCoroutine(comboCoroutine);        }        comboCoroutine = StartCoroutine(CountComboNumber());              comboAnimator.SetBool("ComboAni",true);        InitNunber(comboNumber);    }    private IEnumerator CountComboNumber()    {                yield return new WaitForSeconds(comboTimer);        comboNumber = 0;        InitNunber(comboNumber);    }    void InitNunber(int level)    {             if (level==0)        {            comboNumberTransforms[1].GetComponent
().SetDeActive(); comboNumberTransforms[2].GetComponent
().SetDeActive(); comboNumberTransforms[3].GetComponent
().SetDeActive(); comboHit.sprite = null; } if (level==1) { comboNumberTransforms[1].GetComponent
().SetDeActive(); comboNumberTransforms[2].GetComponent
().SetDeActive(); comboNumberTransforms[3].GetComponent
().SetDeActive(); comboHit.sprite = DataCenter.Instance.GameData.comboSprites.comboHitSprites[0]; } if (level>1 && level < 10) //一位数 { comboNumberTransforms[2].GetComponent
().SetDeActive(); comboNumberTransforms[3].GetComponent
().SetDeActive(); comboNumberSprites[0].sprite = DataCenter.Instance.GameData.comboSprites.comboNumberSprites[level]; comboHit.sprite = DataCenter.Instance.GameData.comboSprites.comboHitSprites[1]; } else if (level>=10 && level < 100) //二位数 { if (level==10) { comboNumberTransform.localPosition = new Vector3(comboNumberTransform.localPosition.x-0.25f,comboNumberTransform.localPosition.y,comboNumberTransform.localPosition.z); } comboNumberTransforms[3].GetComponent
().SetDeActive(); comboNumberSprites[0].sprite = DataCenter.Instance.GameData.comboSprites.comboNumberSprites[level/10]; comboNumberSprites[1].sprite = DataCenter.Instance.GameData.comboSprites.comboNumberSprites[level%10]; comboHit.sprite = DataCenter.Instance.GameData.comboSprites.comboHitSprites[1]; } else if (level>=100&&level <1000) //三位数 { if (level==100) { comboNumberTransform.localPosition = new Vector3(comboNumberTransform.localPosition.x-0.5f,comboNumberTransform.localPosition.y,comboNumberTransform.localPosition.z); } comboNumberSprites[0].sprite = DataCenter.Instance.GameData.comboSprites.comboNumberSprites[level/100]; comboNumberSprites[1].sprite = DataCenter.Instance.GameData.comboSprites.comboNumberSprites[level/10%10]; comboNumberSprites[2].sprite = DataCenter.Instance.GameData.comboSprites.comboNumberSprites[level%10]; comboHit.sprite = DataCenter.Instance.GameData.comboSprites.comboHitSprites[1]; } } #endregion

转载于:https://www.cnblogs.com/qiaogaojian/p/7109541.html

你可能感兴趣的文章
找规律+模拟 之 codevs 1160 蛇形矩阵
查看>>
第三次java作业
查看>>
Mysql数据库操作语句总结(二)
查看>>
git开发问题! [remote rejected] master -> master (pre-receive hook declined)
查看>>
安装Oracle BPM11g R1
查看>>
OpenLDAP权限配置
查看>>
Java中Array.sort()的几种用法
查看>>
数据库启动和关闭的几种方式
查看>>
$.ajax 使用详解
查看>>
移动web资源整理
查看>>
剪切板-监视剪贴板
查看>>
获取sd卡的总大小和可用大小
查看>>
[转]国外Oracle专家服务报价
查看>>
python 面试题
查看>>
an exceptiion has occurred while trying to add a view to region错误
查看>>
原生js面向对象实现移动端轮播图
查看>>
Parallel Python 并行开发多核心并行程序
查看>>
解决80端口占用
查看>>
【最小生成树】Connect the Cities
查看>>
现代软件与游戏的创新性分析
查看>>