Created
January 22, 2021 13:15
-
-
Save boaheck/18c2a5ca78210d1ce420bc61c1f7c500 to your computer and use it in GitHub Desktop.
Enables the use of my project TheFirstPerson(https://github.com/boaheck/TheFirstPerson) with Sophie Houlden's Sinput input system for Unity (https://sophieh.itch.io/sinput)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
[CreateAssetMenu(fileName = "SinputCustomInput", menuName = "TFP/SinputCustomInput", order = 1)] | |
public class TFPSinput : TFPInput | |
{ | |
public override float XAxis() | |
{ | |
return Sinput.GetAxisRaw(xInName); | |
} | |
public override float YAxis() | |
{ | |
return Sinput.GetAxisRaw(yInName); | |
} | |
public override float XMouse() | |
{ | |
return Sinput.GetAxis(xMouseName); | |
} | |
public override float YMouse() | |
{ | |
return Sinput.GetAxis(yMouseName); | |
} | |
public override bool CrouchPressed() | |
{ | |
return Sinput.GetButtonDown(crouchBtn); | |
} | |
public override bool CrouchHeld() | |
{ | |
return Sinput.GetButton(crouchBtn); | |
} | |
public override bool RunPressed() | |
{ | |
return Sinput.GetButtonDown(runBtn); | |
} | |
public override bool RunHeld() | |
{ | |
return Sinput.GetButton(runBtn); | |
} | |
public override bool JumpHeld() | |
{ | |
return Sinput.GetButton(jumpBtn); | |
} | |
public override bool JumpPressed() | |
{ | |
return Sinput.GetButtonDown(jumpBtn); | |
} | |
public override bool UnlockMouseButton() | |
{ | |
return Sinput.GetButtonDown(unlockMouseBtn); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment