//鼠标的点击
//按下鼠标 0左键,1右键,2滚轮
If(Input.GetMouseButtonDown(0)){
Debug.Log(“按下鼠标左键);
}
//持续按下鼠标
If(Input.GetMouseButton(0))
{
Debug.Log(“持续按下鼠标左键”);
}
//抬起鼠标
If(Input.GetMouseButtonUp(0))
{
Debug.Log(“抬起了鼠标左键”);
}
//按下键盘按键
If(Input.GetKeyDown(KeyCode.A))
{
Debug.Log(“按下了A”);
}
//持续按下键盘
If(Input.GetKey(KeyCode.A))
{
Debug.Log(“持续按下A”);
}
//抬起键盘按键
If(Input.GetKeyUp(“A”))
{
Debug.Log(“松开了A”);
}
//判断单点触摸
If(Input.touchCount==1))
{
//触摸对象
Touch touch = Input.toucher[0];
//触摸位置
Debug.Log(“touvh.position”);
//触摸阶段
Switch(touch.phase)
{
case TouchPhase.Began;
Break;
case TouchPhase.Moves;
Break;
case TouchPhase.Stationary
Break;
case TouchPhase.Ended;
Break;
case TouchPhase.Canceled;
Break;
}
}
//判断多点触摸
If(Input.touchCount==2)
{
Touch touch=Input.touches[0];
Touch touch1=Input.touches[1];
}
透视摄像机 近大远小
正交摄像机 一样
//按空格切换声音的播放和暂停
If(Input.GetKeyDown(KeyCode.Space))
{
//如果当前正在播音
If(player.isPlaying)
{
//暂停
player.Pause();
//停止
player.Stop();
}else
{
//继续
play.UnPause();
//开始播放
player.Play();
}
}