Refining the Player Controller

Read Time:1 Minute, 23 Second

Player Controller

Player Controller has two methods:

  1. Interact With Combat
  2. Interact With Movement

These jobs need to be mutually exclusive with preference given to the Interact With Combat method.


Cursor To World

MerlinsBeard.PlayerControls.CursorToWorld

Cursor To World is an abstract class that serves as a base class for the Click To Move and the Click To Attack objects.

Serialized Fields

Layer Mask :: LayerMask

The layer mask is used to restrict the ray cast to objects in a specific layer.

Range :: float

The maximum distance of the ray cast.

Methods

Raycast To World ( ) :bool

This method fires a ray cast from the camera to a point in the game world. It stores a reference to the Raycast Hit object generated by a successful ray cast and returns true.


Click To Move

MerlinsBeard.PlayerControls.ClickToMove

Click To Move inherits from the Cursor To World base class.

Serializable Inner Class

Vector 3 Event : Unity Event <Vector 3>

Serialized Fields

Move To Location : Vector 3 Event

This is event is used by Move To Location to pass the location discovered by the last Raycast To World call.

Methods

Move To Location ( )

This method fires the Move To Location event, passing in the location discovered by the last Raycast To World call.


Click To Attack

MerlinsBeard.PlayerControls.ClickToAttack

Click To Attack inherits from the Cursor To World base class.

Serialized Fields

Attack Target : Target . Target Event

This is event is used by Attack Target to pass the Target discovered by the last Raycast To World call.

Methods

Attack Target ( )

This method fires the Attack Target event, passing in the Target discovered by the last Raycast To World call.

Happy
Happy
0 %
Sad
Sad
0 %
Excited
Excited
0 %
Sleppy
Sleppy
0 %
Angry
Angry
0 %
Surprise
Surprise
0 %

Average Rating

5 Star
0%
4 Star
0%
3 Star
0%
2 Star
0%
1 Star
0%

Leave a Reply

Your email address will not be published. Required fields are marked *