Logo
 All Classes Files Functions Variables Enumerations
Classes | Public Member Functions | Public Attributes | List of all members
TrackingToggle Class Reference

Classes

class  KeybindList

Public Member Functions

int TargetCount ()
void AddTrackingTarget (Transform t)
void RemoveTrackingTarget (Transform t)
void PreviousTarget ()
bool JumpToTarget (Transform t)

Public Attributes

bool isActive = true
bool forceTrackingMode = false
KeybindList keybindings
List< Transform > trackingTargets

Detailed Description

A class which enables target toggling

This script implements a simple tracking target switching mechanic using the dynamic camera. Attach this to a dynamic camera, provide it a list of targets, and you can toggle the TrackingTargets That the camera will focus on.

The keys to toggle are able to be set within Unity's inspector.

This is capabale of handling unexpected null varaiables, but using the AddTrackingTarget() and RemoveTrackingTarget() methods is the recommended way of modifying the list in code.

For a similar implementation, see TargetToggle

See Also
TargetToggle

Member Function Documentation

void TrackingToggle.AddTrackingTarget ( Transform  t)

Adds a target to the list of tracking targets

This attempts to add a new target to the list of targets. Null values will result in an error and no change to the list.

Parameters
tThe new tranform to add
See Also
RemoveTrackingTarget
trackingTargets
bool TrackingToggle.JumpToTarget ( Transform  t)

This shifts the current target to a specified target

This will attempt to make the current camera trackingTarget the argument provided. If the list is empty, the argument is null, or the argument is not in the list, a warning will be reported.

Parameters
tThe transform to jump to
void TrackingToggle.PreviousTarget ( )

This method goes to the previous entry in the list, and will wrap to the end of the list if the current element is the first in the list.

void TrackingToggle.RemoveTrackingTarget ( Transform  t)

This attempts to remove a tracking target from the list of targets A null or non-existant value will result in an error. If the current target is removed, the toggler switches to the previous target.

Parameters
tThe transform to remove
See Also
AddTrackingTarget
trackingTargets
int TrackingToggle.TargetCount ( )

Returns the number of items currently in the tracking list.

Returns
The number of targets in the tracking list
See Also
trackingTargets

Member Data Documentation

bool TrackingToggle.forceTrackingMode = false

Determines if CameraMode.TargetTrcking will be enforced

If true, the camera will be set to TargetTracking mode each update

bool TrackingToggle.isActive = true

Determines if the controller will respond to IO

If true, keyboard input will be read and targets will be toggled between. If false, new input will not be processed.

KeybindList TrackingToggle.keybindings

Wraps the keybindings which toggle

See Also
KeybindList
List<Transform> TrackingToggle.trackingTargets

The list of targets to track between

This is the list of targets that the TrackingToggle will cycle between. It can be modified externally, but it is recommended that you modify this via code during runtime, using the Add/Remove methods to avoid unexpected errors.

If you manually alter this List during runtime, there is a chance of serious errors.


The documentation for this class was generated from the following file: