void Update() { State = CHState.Stand; //Vector3 direction = transform.right * Input.GetAxis ("Horizontal"); if (Input.GetButton("Horizontal")) // (Xcoord != thisObject.transform.position.x) { State = CHState.Walk; if (Input.GetKey(KeyCode.LeftShift)) { State = CHState.Run; } } else //if (direction.x == 0) { State = CHState.Stand; } if (Input.GetKeyDown(KeyCode.Space)) { State = CHState.Jump; } if (Input.GetKeyDown(KeyCode.LeftControl))//(Input.GetKey(KeyCode.LeftControl)) { State = CHState.Attack; } Xcoord = thisObject.transform.position.x; }
void Update() { State = CHState.Stand; Vector3 direction = transform.right * Input.GetAxis("Horizontal"); if (direction.x != 0) { State = CHState.Walk; } else if (direction.x == 0) { State = CHState.Stand; } if (Input.GetButtonDown("Jump")) { State = CHState.Jump; } }