void Start() { //mathf是Unity的数学计算的结构体,用来数学计算 //以下只进行一次计算 //1.π print("π:" + Mathf.PI); //2.取绝对值 print("取绝对值:"+Mathf.Abs(-10)); //3.向上取整 float f = 1.3f; print("向上取整:"+Mathf.CeilToInt(f));//2; //4.向下取整 print("向下取整:" + Mathf.FloorToInt(9.6f));//1 //5.钳制函数 clamp,参1在参2和参3之间,就取参1的值, //参1比参2小,取参2,参1比参3大,取参3 print(Mathf.Clamp(10, 11, 20));//11 print(Mathf.Clamp(21, 11, 20));//20 print(Mathf.Clamp(15,
public float endtime=10;endtime = Mathf.MoveTowards(endtime, 0, Time.deltaTime * 1f);print(Mathf.RoundToInt(endtime))Mathf.RoundToInt 四舍五入Mathf.MoveTowards 返回一个浮点数,参1向参2的值靠近,由参3决定
1.Edit-project settings-player-Configuration-Active Input Handing-Input System Package(New)2.window-package Manager-Unity Registry-Input System-Install3.在project下,右键create-Input ActionsAction Type 模拟按键的类型Interactions 互动样式,有tap,hold,press等
Edit-Project settings-Graphics-Camera Settings-Transparency Sort Mode-Custom AxisX 0 Y 1 Z 0这样y轴值越大,越显示后面,y值越小,越显示前面同时,需要改变某些物体的轴心点,比如由center改为pivot,设置在底部
public Transform enemypos1;//前三个参数为RGB数值,第四个是alpha透明度enemypos1.GetComponent().color = new Color32(255, 255, 255, 100);
一棵小松林
Gamer游戏开发者