Quaternion
Quaternion
insideUnitCircle:以当前位置为中心,一定范围为半径的圆内随机生成
insideUnitSphere:以当前位置为中心,一定范围为半径的球内随机生成
value:随机生成0~1之间的值包括0和1
state:可以保存生成器的状态,接着当前的随机数的状态生成
rotation:随机得到一个朝向
随机生成数字,生成的数字不包括最大值
Random
InitState:初始化状态
project:投影长度
Equals:判断两个向量是否相等
Normslize:自身单位化
Set:赋值
ToString:转变成字符串,可以进行一个格式化的输出
lerp:
Angle:
Distance:
MoveTowards:
Reflect:
Scale:
变量
magnitude:取得向量的长度
normalized:对向量进行单位化
sqrMagnitude:取得向量的长度的平方
mousePosition:鼠标在屏幕的坐标
使用GetAxis得到轴的值的变化来控制移动
if (Input.GetKeyDown(KeyCode.Space))
{
print("KeyDown");
}
if (Input.GetKeyUp(KeyCode.Space))
{
print("KeyUp");
if (Input.GetKey(KeyCode.Space))
{
print("Key");
}
PingPang:两点之间来回运动
MoveTowards 匀速运动
print()
public static float Lerp(float a,float b,float t);
abs 取绝对值
ceil 向上取整
i<=1;i+=0.1f
deltaTime:每一帧的时间间隔
fixedTime:游戏运行一共占用的时间
frameCount:帧数
realtimeSinceStartup:游戏从开始到现在一直占用的时间,游戏暂停的话会继续开始计时
smoothDeltaTime
time:游戏运行一共占用的时间
timeSinceLevelLoad:游戏运行一共占用的时间
得到组件各种方法函数:
GetComponent<组件类型>();
GetCompoents<组件类型>();
GetCompoentsInChilren<组件类型>();
GetComponentsInChildren<组件类型>();
GetComponentInParent<组件类型>();
GetCompoentsInParent<组件类型>();
//发送该节点的所有子节点
GameObject.BroadcastMessage(string methodName, object parameter = null, SendMessageOptions options = SendMessageOptions.RequireReceiver);
//发送给物体本身的广播
GameObject.SendMessage(string methodName, object value = null, SendMessageOptions options = SendMessageOptions.RequireReceiver);
//发送给发节点的所有基(父)节点
GameObject.SendMessageUpwards(string methodName, object value = null, SendMessageOptions options = SendMessageOptions.RequireReceiver);
GameObject.Find("Main Camera");
GameObject.FindGameObjectsWithTag("Main Camera");