// Update is called once per frame void Update() { //Mouse Input if (Input.GetKey(KeyCode.Mouse0)) { if (OnMouseLeft != null) { OnMouseLeft(CastRayFromCamera()); } PressCount++; } if (Input.GetKeyDown(KeyCode.Mouse0)) { if (OnMouseLeftDown != null) { OnMouseLeftDown(CastRayFromCamera()); } PressCount++; } if (Input.GetKeyUp(KeyCode.Mouse0)) { if (OnMouseLeftUp != null) { OnMouseLeftUp(CastRayFromCamera()); } PressCount++; } //Axis Inputs //Horizontal Axis if (HorizontalAxis != null) { float HorAx = Input.GetAxis(options.s_Horizontal); if (HorAx > options.AxisDeadzone) { HorizontalAxis(HorAx); MovementCount++; } else { HorizontalAxis(0f); } } if (VerticalAxis != null) { //Vertical Axis float VerAx = Input.GetAxis(options.s_Vertical); if (VerAx > options.AxisDeadzone) { VerticalAxis(VerAx); MovementCount++; } else { VerticalAxis(0f); } } //Movement Input if (Input.GetKey(options.forward)) { if (OnForward != null) { OnForward.Invoke(); } if (VerticalAxis != null) { VerticalAxis(1); } PressCount++; MovementCount++; } if (Input.GetKey(options.backward)) { if (OnBackward != null) { OnBackward.Invoke(); } if (VerticalAxis != null) { VerticalAxis(-1); } PressCount++; MovementCount++; } if (Input.GetKey(options.straferight)) { if (OnStraferight != null) { OnStraferight.Invoke(); } if (HorizontalAxis != null) { HorizontalAxis(1); } PressCount++; MovementCount++; } if (Input.GetKey(options.strafeleft)) { if (OnStrafeleft != null) { OnStrafeleft.Invoke(); } if (HorizontalAxis != null) { HorizontalAxis(-1); } PressCount++; MovementCount++; } if (Input.GetKey(options.jump)) { OnJump.NullCheckInvoke(); PressCount++; } if (Input.GetKeyDown(options.jump)) { OnJumpDown.NullCheckInvoke(); PressCount++; } if (Input.GetKeyUp(options.jump)) { OnJumpUp.NullCheckInvoke(); } if (Input.GetKey(options.run)) { OnRun.NullCheckInvoke(); PressCount++; } if (Input.GetKeyDown(options.run)) { OnRunDown.NullCheckInvoke(); PressCount++; } if (Input.GetKeyUp(options.run)) { OnRunUp.NullCheckInvoke(); } if (OnMovement != null) { if (MovementCount > 0) { OnMovement(true); } else { OnMovement(false); } } if (PressCount > 0) { OnAnyKey.NullCheckInvoke(); PressCount = 0; } }