protected virtual void CameraInput(IInput axisInput) { if (!cameraMain) { if (!Camera.main) { Debug.Log("Missing a Camera with the tag MainCamera, please add one."); } else { cameraMain = Camera.main; cc.rotateTarget = cameraMain.transform; } } if (cameraMain) { cc.UpdateMoveDirection(cameraMain.transform); } if (tpCamera == null) { return; } var Y = axisInput.GetAxis(rotateCameraYInput); var X = axisInput.GetAxis(rotateCameraXInput); tpCamera.RotateCamera(X, Y); }
protected virtual Vector2 RotateAxes() { IInput input = m_component.Editor.Input; float deltaX = input.GetAxis(InputAxis.X); float deltaY = input.GetAxis(InputAxis.Y); return(new Vector2(deltaX, deltaY)); }
/// <summary> /// Gets the input logic by reading from an input object /// </summary> /// <param name="input">The input object to read from</param> /// <returns>Calculated input logic</returns> public static InputLogic GetInputLogic(IInput input) { return(GetInputLogic( input.GetAxis("Horizontal"), input.GetAxis("Vertical"), input.GetButtonDown("Jump"), input.GetButton("Jump"))); }
// Update is called once per frame void Update() { float x = input.GetAxis("Horizontal"); float xMovement = x * speed * time.DeltaTime; float y = input.GetAxis("Vertical"); float yMovement = y * speed * time.DeltaTime; transform.Translate(xMovement, yMovement, 0); }
public override void Update() { float deltaX = input.GetAxis("Horizontal"); float deltaY = input.GetAxis("Vertical"); Vector3 forceVec = (Vector3.right * deltaX + Vector3.forward * deltaY); if (forceVec.sqrMagnitude > 0) { sphere.body.AddForce(forceVec); } }
protected virtual float ZoomAxis() { IInput input = m_component.Editor.Input; float deltaZ = input.GetAxis(InputAxis.Z); return(deltaZ); }
protected virtual Vector3 MoveAxes() { IInput input = m_component.Editor.Input; float deltaX = input.GetAxis(InputAxis.Horizontal); float deltaY = input.GetAxis(InputAxis.Vertical); float deltaZ = 0; if (input.GetKey(KeyCode.Q)) { deltaZ = 0.5f; } else if (input.GetKey(KeyCode.E)) { deltaZ = -0.5f; } return(new Vector3(deltaX, deltaY, deltaZ)); }
public static Readings GetReadings( Rigidbody2D skateboard, SpooderMotion.Status status, IInput input) { return(new Readings() { SB_Angle = skateboard.rotation, SB_AngularVelocity = skateboard.angularVelocity, SB_WorldSpeedX = skateboard.velocity.x, SB_WorldSpeedY = skateboard.velocity.y, IsPhysicallySupported = status.IsPhysicallySupported ? 1f : 0f, IsGrinding = 0f, // TODO Input_Horizontal = input.GetAxis("Horizontal"), Input_Vertical = input.GetAxis("Vertical"), Input_Jump = input.GetAxis("Jump") }); }
public virtual void MoveInput(IInput axisInput) { cc.input.x = axisInput.GetAxis(horizontalInput); cc.input.z = axisInput.GetAxis(verticallInput); }