Buenas noches,
Una pregunta por favor:
Tengo un simple input de teclas que mueven mi personaje con una animación con tecla asignada.
Quiero hacer que al apretar la tecla "flecha arriba" + control derecha , pues en vez de andar corra.
Para eso he creado dos variables distintas:
Velocidad y Correr con sus respectivas animaciones.
Pero al apretar simultaneamente o una tras de otra , no se ejecuta , le he puesto un debug,log pero tampoco aparece.
using UnityEngine;
using System.Collections;
public class moverplayer : MonoBehaviour
{
// En esta variable configuraremos la velocidad a la que se moverá el objeto
public float Velocidad = 1.0F;
public float Correr = 4.0F;
private Animation anim;
public float jumpHight = 0.5F;
public float jumptime = 0.300F;
public float smoothFactor = 5;
//public Quaternion rotation = Quaternion.Euler(new Vector3(0, 30, 0));
void Start()
{
anim = GetComponent<Animation> ();
}
void Update ()
{
// Movemos el objeto hacia adelante
if (Input.GetKey (KeyCode.UpArrow)) {
transform.Translate (Vector3.forward * Time.deltaTime * Velocidad);
transform.forward = new Vector3 (0f, 0f, 1f);
anim.Play ("walk00");
}
else if(Input.GetKey(KeyCode.DownArrow))
{
//atras
transform.Translate(Vector3.back * Time.deltaTime * Velocidad,Space.World);
transform.forward = new Vector3(-0f,0f,-1f);
anim.Play ("walk00");
}
else if(Input.GetKey(KeyCode.RightArrow))
{
//derecha
transform.Translate(Vector3.right