0% found this document useful (0 votes)
30 views

Wolf Mobile Controller

This document discusses how to add additional inputs and make a game mobile compatible. It explains that there are two types of inputs in the original code: states and modes. To add a new state input, the ActivateAnyAction function must be called with the input name and isState set to true. For a new mode input, isState would be false. Several key scripts are described that handle input and camera movement for mobile, including SlingshotController, MFreeLookCamera, FloatingJoystick, and Joystick. Customizing the joystick deadzone is also covered to avoid accidental input registration.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views

Wolf Mobile Controller

This document discusses how to add additional inputs and make a game mobile compatible. It explains that there are two types of inputs in the original code: states and modes. To add a new state input, the ActivateAnyAction function must be called with the input name and isState set to true. For a new mode input, isState would be false. Several key scripts are described that handle input and camera movement for mobile, including SlingshotController, MFreeLookCamera, FloatingJoystick, and Joystick. Customizing the joystick deadzone is also covered to avoid accidental input registration.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Brief Introduction:

How the Original Input works and how to add more features and make it mobile
Compatible?

We have 2 different types of Input in the original code:

States ( can be found here ):


Modes ( can be found here ):

Those inputs are added to Malbers Input ( You can read more about this in the original
documentation but I want to explain how to add more inputs to the mobile game ):
After adding a new feature following the asset's documentation, if it's a “State”
you have to call this code in GameReferences.cs

ActivateAnyAction(string inputName,bool isState)

iinputName would be the input you set for that state in MalbersInput and isState would be true

If you added a new “Mode” isState would be false.

An example:

(Check out selected code)

Jump is a state
Action and Attack are modes.

PickAndDrop has it's own script and code so we don't use “ActivateAnyAction”
SlingshotController.cs

There is all the code to aim and shoot the ball and also to pivot the camera while aiming.

MFreeLookCamera.cs

That script was modified to take mobile input & PC input as well.

“XCam” variable is the horizontal input, it takes the input from


GameReferences.Instance.CamHorizontalValue

Which is assigned in SlingshotController.cs since it only takes the input from the joystick if you
aren't aiming, in that case, in SlingshotController.cs it's calculated the movement of the finger
to pivot the camera.

FloatingJoystick.cs

All the code there was commented since we want the joystick to be static at X position and to
not be displayed at any place. It inherits from Joystick.cs

Joystick.cs

I modified the DeadZone feature, to avoid that the joystick receives any input if you touch
inside of any place of the joystick, if DeadZone > 0, you need to drag the joystick X distance
before the Joystick taking any input.

These were the main script features, if you need help with anything just let me know!, Thanks

You might also like