-1
当我的pnj正在运行(按下右键),并尝试跳转pnj跳转。但很少,我怎么能解决这个问题?统一3d跳转很短
这是没有问题的时候我让按右边的按钮,但我希望做一个游戏没有失败,我想在IO正在运行跳,thanks¡
void Update() {
if (Input.GetKeyDown (KeyCode.Space)) {
if (corriendo) {
if (enSuelo || !dobleSalto) {
GetComponent<Rigidbody2D>().velocity = new Vector2 (GetComponent<Rigidbody2D>().velocity.x, 0);
GetComponent<Rigidbody2D>().AddForce(Vector2.up * fuerzaSalto);
if (!dobleSalto && !enSuelo){
dobleSalto=true;
}
}
corriendo = true;
}
}
if ((enSuelo || !dobleSalto) && Input.GetKeyDown (KeyCode.Space)) {
GetComponent<Rigidbody2D>().velocity = new Vector2 (GetComponent<Rigidbody2D>().velocity.x, 0);
GetComponent<Rigidbody2D>().AddForce(Vector2.up * fuerzaSalto);
if (!dobleSalto && !enSuelo){
dobleSalto=true;
}
}
if (Input.GetKey (KeyCode.RightArrow) && enSuelo==true) {
if (velocidad > 17) {
velocidad = 17;
}
GetComponent<Rigidbody2D>().velocity = new Vector2 (GetComponent<Rigidbody2D>().velocity.x, 0);
GetComponent <Rigidbody2D>().AddForce (Vector2.right * velocidad);
velocidad++;
} else {
if (velocidad > 1) {
velocidad--;
} else {
velocidad = 0;
}
}
}