public float GetValue() { posVal = InputManager.GetBind(positiveBind); negVal = InputManager.GetBind(negativeBind); if (posVal || negVal) { if (posVal && negVal) { if (value == 0) { dualInput = true; } } else if (posVal) { dualInput = false; if (snap && value < 0) { value = 0; } value = Mathf.MoveTowards(value, 1, sens * Time.deltaTime); GetRawInput(); return(value); } else if (negVal) { dualInput = false; if (snap && value > 0) { value = 0; } value = Mathf.MoveTowards(value, -1, sens * Time.deltaTime); GetRawInput(); return(value); } } else { dualInput = false; } value = Mathf.MoveTowards(value, 0, gravity * Time.deltaTime); GetRawInput(); return(value); }
public int GetRawValue() { posRVal = InputManager.GetBind(positiveBind); negRVal = InputManager.GetBind(negativeBind); if (posRVal || negRVal) { if (posRVal && negRVal) { dualInput = true; } else if (posRVal) { dualInput = false; value = 1; rawValue = 1; return(rawValue); } else if (negRVal) { dualInput = false; value = -1; rawValue = -1; return(rawValue); } } else { dualInput = false; } value = 0; rawValue = 0; return(rawValue); }
void Update() { if (raw) { direction.z = walkAxis.GetRawValue(); direction.x = strafeAxis.GetRawValue(); } else { direction.z = walkAxis.GetValue(); direction.x = strafeAxis.GetValue(); } transform.position += direction * speed * Time.deltaTime; if (InputManager.GetBind("On Foot.Jump")) { transform.localScale = Vector3.MoveTowards(transform.localScale, new Vector3(2, 2, 2), growRate * Time.deltaTime); } else { transform.localScale = Vector3.MoveTowards(transform.localScale, Vector3.one, growRate * Time.deltaTime); } }