Unity Array技巧之快速构建0011,000111形式数组
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,新建一个空工程,具体如下图



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