第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

unity OnTriggerEnter

unity OnTriggerEnter

C#
收到一只叮咚 2021-06-25 17:57:45
我希望我的 Player 與對(duì)象膠囊發(fā)生碰撞。這個(gè)動(dòng)作應(yīng)該摧毀膠囊并為玩家增加一個(gè) 10 的速度值。但是這段代碼不起作用:public class PlayerController : MonoBehaviour {public KeyCode moveL;public KeyCode moveR;public float horizontal = 0;public int laneNum = 2;public string controllocked = "n";public float speed;void Update (){    GetComponent<Rigidbody>().velocity = new Vector3(horizontal, GM.verticalVelocity, speed);    if ((Input.GetKeyDown(moveL)) && (laneNum > 1) && (controllocked == "n"))    {        horizontal = -2;        StartCoroutine(StopSlide());        laneNum = laneNum - 1;        controllocked = "y";    }    else if ((Input.GetKeyDown(moveR)) && (laneNum < 3) && (controllocked =="n"))    {        horizontal = 2;        laneNum = laneNum + 1;        StartCoroutine(StopSlide());        controllocked = "y";    }}void OnCollisionEnter(Collision other){    if(other.gameObject.tag == "lethal")    {        Destroy(gameObject);    }    if (other.gameObject.name == "Capsule")    {        Destroy(other.gameObject);        speed = 10;       }}IEnumerator StopSlide(){    yield return new WaitForSeconds(.5f);    horizontal = 0;    controllocked = "n";}到目前為止我嘗試過的是speed += 10,speed++兩者都不起作用。
查看完整描述

1 回答

  • 1 回答
  • 0 關(guān)注
  • 145 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)