切换场景代码
public void rt(){
SceneManager.LoadScene(1);
}
移动代码
public void rt(){
transform.Translate(moveVec * speed * Time.deltaTime);
}
旋转代码
public void rt(){
transform.Rotate(moveVec * speed * Time.deltaTime);
}
按下,抬起
private void OnMouseDown()//按下
{
}
private void OnMouseup()//抬起
{
}
暂停
public void rt(){
Time.timeScale = 1;
}
协程的创建和调用
public Text Timetext;
private int Time = 0;
void Update () {
StartCoroutine(TimeCount());//调用
}
//创建
public IEnumerator TimeCount()
{
for (int i = Time; i >= 0; i++)
{
yield return new WaitForSeconds(0);
Timetext.text = i / 60 + " : " + i % 60;
}
}
销毁
public void rt(){
Destroy(gameObject);//销毁自身
}
实例化
public GameObject[] emeyWalt;
public void rt(){
//实例化 //初始位置 //不旋转
Instantiate(emeyWalt, transform.position, Quaternion.identity);
}