Skip to content

Instantly share code, notes, and snippets.

@travisdmathis
Created December 2, 2019 02:50
Show Gist options
  • Save travisdmathis/5f9a1c908115ca80eee398106e5c6ebc to your computer and use it in GitHub Desktop.
Save travisdmathis/5f9a1c908115ca80eee398106e5c6ebc to your computer and use it in GitHub Desktop.
public enum INPUT_TYPE
{
PointAndClick,
Directional,
FollowPointer,
PointClickOrFollowPointer,
SideScrollX,
SideScrollZ,
TankControl
}
protected virtual void UpdateInputPointClickOrFollowPointer()
{
if (!this.IsControllable()) return;
this.UpdateUIConstraints();
if (Input.GetMouseButton((int)this.mouseButtonMove) && !this.uiConstrained)
{
this.UpdateInputFollowPointer();
}
else if (Input.GetMouseButtonUp((int)this.mouseButtonMove) && !this.uiConstrained)
{
Camera maincam = this.GetMainCamera();
if (maincam == null) return;
Ray cameraRay = maincam.ScreenPointToRay(Input.mousePosition);
this.characterLocomotion.SetTarget(cameraRay, this.mouseLayerMask, null, 0f, null);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment