2D游戏学习笔记
2019-07-30 本文已影响0人
Curry_Ming
1.用修饰符const修饰的常量可以直接通过类名.变量名调用
public class Tags : MonoBehaviour
{
public const string BulletPar = "BulletPar";
public const string Item = "Item";
public const string Player = "Player";
}
2.SetActive为false的物体是用Find之类的函数查找不到的
3.反转动画片段

4.对于一些比较难剪的图片,可以直接这样

5.去除物理作用

6.为粒子效果去边框

随机两张图片

使粒子效果有一种跟随的感觉

使粒子效果有一种消失的感觉,渐变成透明


7.设置为World Space的Canvas可以为其设置Sorting Layer


8.当需要在世界中建立一个Text时,需要把Text的Scale设置好,不然字体会很大,会很模糊

9.判断音频是否正在播放
private void SetFootStep()
{
if (moveHorizontalValue != 0 || moveVerticalValue != 0)
{
if (!footStepAudio.isPlaying)
{
footStepAudio.Play();
}
}
}
10.获取Animator当前播放的动画的名字(括号内的0是动画层的序号,BaseLayer为第0层,方括号内的0是当前动画层正在播放的动画的下标)
