Unity Array技巧之快速构建0011,000111形式数组

2025-06-25 20:18:24

Unity Array技巧之快速构建0011,000111形式数组。本节介绍使用技巧快速构建0011,000111形式的数组,具体如下图

工具/原料

Unity

一、知识要点

1、Mathf.FloorToInt:1)功能简述public 衡痕贤伎static intFloorToInt(floatf);Returns t茑霁酌绡he largest integer smaller to or equal tof.2)使用举例using UnityEngine;using System.Collections;public class ExampleClass : MonoBehaviour { void Example() { Debug.Log(Mathf.FloorToInt(10.0F)); Debug.Log(Mathf.FloorToInt(10.2F)); Debug.Log(Mathf.FloorToInt(10.7F)); Debug.Log(Mathf.FloorToInt(-10.0F)); Debug.Log(Mathf.FloorToInt(-10.2F)); Debug.Log(Mathf.FloorToInt(-10.7F)); }}

二、Array技巧之快速构建0011,000111形式数组

1、打开Unity,新建一个空工程,具体如下图

Unity Array技巧之快速构建0011,000111形式数组Unity Array技巧之快速构建0011,000111形式数组Unity Array技巧之快速构建0011,000111形式数组

6、运行场景,分别按下“A”、“S”和“D”,在控制台Console打印的结果与预期一致,具体如下图

Unity Array技巧之快速构建0011,000111形式数组
声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
猜你喜欢