|
| virtual void | Reset () |
| | Call this to reset the target and speed of this magnetic object.
|
| virtual void | ResetPosition () |
| | Call this to reset the position of the magnetic to its initial position.
|
| virtual void | StopFollowing () |
| | Prevents the object from following the target anymore.
|
| virtual void | StartFollowing () |
| | Makes the object follow the target.
|
| virtual void | SetTarget (Transform newTarget) |
| | Sets a new target for this object to magnet towards.
|
|
| LayerMask | TargetLayerMask = LayerManager.PlayerLayerMask |
| | the layermask this magnetic element is attracted to
|
| bool | StartMagnetOnEnter = true |
| | whether or not to start moving when something on the target layer mask enters this magnetic element's trigger
|
| bool | StopMagnetOnExit = false |
| | whether or not to stop moving when something on the target layer mask exits this magnetic element's trigger
|
| int | MagneticTypeID = 0 |
| | a unique ID for this type of magnetic objects. This can then be used by a MagneticEnabler to target only that specific ID. An ID of 0 will be picked by all MagneticEnablers automatically.
|
| Vector3 | Offset |
| | the offset to apply to the followed target
|
| bool | InterpolatePosition = true |
| | whether or not we need to interpolate the movement
|
| float | FollowPositionSpeed = 5f |
| | the speed at which to interpolate the follower's movement
|
| float | FollowAcceleration = 0.75f |
| | the acceleration to apply to the object once it starts following
|
| UpdateModes | UpdateMode = UpdateModes.Update |
| | the update at which the movement happens
|
| GameObject | CopyState |
| | an object this magnetic object should copy the active state on
|
| Transform | Target |
| | the target to follow, read only, for debug only
|
| bool | FollowPosition = true |
| | whether or not the object is currently following its target's position
|
|
| virtual void | Awake () |
| | On Awake we initialize our magnet.
|
| virtual void | OnEnable () |
| virtual void | Initialization () |
| | Grabs the collider and ensures it's set as trigger, initializes the speed.
|
| virtual void | OnTriggerEnter2D (Collider2D colliding) |
| | When something enters our trigger, if it's a proper target, we start following it.
|
| virtual void | OnTriggerExit2D (Collider2D colliding) |
| | When something exits our trigger, we stop following it.
|
| virtual void | OnTriggerEnter (Collider colliding) |
| | When something enters our trigger, if it's a proper target, we start following it.
|
| virtual void | OnTriggerExit (Collider colliding) |
| | When something exits our trigger, we stop following it.
|
| virtual void | OnTriggerEnterInternal (GameObject colliding) |
| | Starts following an object we trigger with if conditions are met.
|
| virtual void | OnTriggerExitInternal (GameObject colliding) |
| | Stops following an object we trigger with if conditions are met.
|
| virtual void | Update () |
| | At update we follow our target.
|
| virtual void | FixedUpdate () |
| | At fixed update we follow our target.
|
| virtual void | LateUpdate () |
| | At late update we follow our target.
|
| virtual void | FollowTargetPosition () |
| | Follows the target, lerping the position or not based on what's been defined in the inspector.
|
◆ UpdateModes
the possible update modes
| Enumerator |
|---|
| Update | |
| FixedUpdate | |
| LateUpdate | |
◆ Awake()
| virtual void MoreMountains.TopDownEngine.Magnetic.Awake |
( |
| ) |
|
|
protectedvirtual |
On Awake we initialize our magnet.
◆ FixedUpdate()
| virtual void MoreMountains.TopDownEngine.Magnetic.FixedUpdate |
( |
| ) |
|
|
protectedvirtual |
At fixed update we follow our target.
◆ FollowTargetPosition()
| virtual void MoreMountains.TopDownEngine.Magnetic.FollowTargetPosition |
( |
| ) |
|
|
protectedvirtual |
Follows the target, lerping the position or not based on what's been defined in the inspector.
◆ Initialization()
| virtual void MoreMountains.TopDownEngine.Magnetic.Initialization |
( |
| ) |
|
|
protectedvirtual |
Grabs the collider and ensures it's set as trigger, initializes the speed.
◆ LateUpdate()
| virtual void MoreMountains.TopDownEngine.Magnetic.LateUpdate |
( |
| ) |
|
|
protectedvirtual |
At late update we follow our target.
◆ OnEnable()
| virtual void MoreMountains.TopDownEngine.Magnetic.OnEnable |
( |
| ) |
|
|
protectedvirtual |
◆ OnTriggerEnter()
| virtual void MoreMountains.TopDownEngine.Magnetic.OnTriggerEnter |
( |
Collider | colliding | ) |
|
|
protectedvirtual |
When something enters our trigger, if it's a proper target, we start following it.
- Parameters
-
◆ OnTriggerEnter2D()
| virtual void MoreMountains.TopDownEngine.Magnetic.OnTriggerEnter2D |
( |
Collider2D | colliding | ) |
|
|
protectedvirtual |
When something enters our trigger, if it's a proper target, we start following it.
- Parameters
-
◆ OnTriggerEnterInternal()
| virtual void MoreMountains.TopDownEngine.Magnetic.OnTriggerEnterInternal |
( |
GameObject | colliding | ) |
|
|
protectedvirtual |
Starts following an object we trigger with if conditions are met.
- Parameters
-
◆ OnTriggerExit()
| virtual void MoreMountains.TopDownEngine.Magnetic.OnTriggerExit |
( |
Collider | colliding | ) |
|
|
protectedvirtual |
When something exits our trigger, we stop following it.
- Parameters
-
◆ OnTriggerExit2D()
| virtual void MoreMountains.TopDownEngine.Magnetic.OnTriggerExit2D |
( |
Collider2D | colliding | ) |
|
|
protectedvirtual |
When something exits our trigger, we stop following it.
- Parameters
-
◆ OnTriggerExitInternal()
| virtual void MoreMountains.TopDownEngine.Magnetic.OnTriggerExitInternal |
( |
GameObject | colliding | ) |
|
|
protectedvirtual |
Stops following an object we trigger with if conditions are met.
- Parameters
-
◆ Reset()
| virtual void MoreMountains.TopDownEngine.Magnetic.Reset |
( |
| ) |
|
|
virtual |
Call this to reset the target and speed of this magnetic object.
◆ ResetPosition()
| virtual void MoreMountains.TopDownEngine.Magnetic.ResetPosition |
( |
| ) |
|
|
virtual |
Call this to reset the position of the magnetic to its initial position.
◆ SetTarget()
| virtual void MoreMountains.TopDownEngine.Magnetic.SetTarget |
( |
Transform | newTarget | ) |
|
|
virtual |
Sets a new target for this object to magnet towards.
- Parameters
-
◆ StartFollowing()
| virtual void MoreMountains.TopDownEngine.Magnetic.StartFollowing |
( |
| ) |
|
|
virtual |
Makes the object follow the target.
◆ StopFollowing()
| virtual void MoreMountains.TopDownEngine.Magnetic.StopFollowing |
( |
| ) |
|
|
virtual |
Prevents the object from following the target anymore.
◆ Update()
| virtual void MoreMountains.TopDownEngine.Magnetic.Update |
( |
| ) |
|
|
protectedvirtual |
At update we follow our target.
◆ _collider
| Collider MoreMountains.TopDownEngine.Magnetic._collider |
|
protected |
◆ _collider2D
| Collider2D MoreMountains.TopDownEngine.Magnetic._collider2D |
|
protected |
◆ _direction
| Vector3 MoreMountains.TopDownEngine.Magnetic._direction |
|
protected |
◆ _initialPosition
| Vector3 MoreMountains.TopDownEngine.Magnetic._initialPosition |
|
protected |
◆ _lastTargetPosition
| Vector3 MoreMountains.TopDownEngine.Magnetic._lastTargetPosition |
|
protected |
◆ _newPosition
| Vector3 MoreMountains.TopDownEngine.Magnetic._newPosition |
|
protected |
◆ _newTargetPosition
| Vector3 MoreMountains.TopDownEngine.Magnetic._newTargetPosition |
|
protected |
◆ _speed
| float MoreMountains.TopDownEngine.Magnetic._speed |
|
protected |
◆ _velocity
| Vector3 MoreMountains.TopDownEngine.Magnetic._velocity = Vector3.zero |
|
protected |
◆ CopyState
| GameObject MoreMountains.TopDownEngine.Magnetic.CopyState |
an object this magnetic object should copy the active state on
◆ FollowAcceleration
| float MoreMountains.TopDownEngine.Magnetic.FollowAcceleration = 0.75f |
the acceleration to apply to the object once it starts following
◆ FollowPosition
| bool MoreMountains.TopDownEngine.Magnetic.FollowPosition = true |
whether or not the object is currently following its target's position
◆ FollowPositionSpeed
| float MoreMountains.TopDownEngine.Magnetic.FollowPositionSpeed = 5f |
the speed at which to interpolate the follower's movement
◆ InterpolatePosition
| bool MoreMountains.TopDownEngine.Magnetic.InterpolatePosition = true |
whether or not we need to interpolate the movement
◆ MagneticTypeID
| int MoreMountains.TopDownEngine.Magnetic.MagneticTypeID = 0 |
a unique ID for this type of magnetic objects. This can then be used by a MagneticEnabler to target only that specific ID. An ID of 0 will be picked by all MagneticEnablers automatically.
◆ Offset
| Vector3 MoreMountains.TopDownEngine.Magnetic.Offset |
the offset to apply to the followed target
◆ StartMagnetOnEnter
| bool MoreMountains.TopDownEngine.Magnetic.StartMagnetOnEnter = true |
whether or not to start moving when something on the target layer mask enters this magnetic element's trigger
◆ StopMagnetOnExit
| bool MoreMountains.TopDownEngine.Magnetic.StopMagnetOnExit = false |
whether or not to stop moving when something on the target layer mask exits this magnetic element's trigger
◆ Target
| Transform MoreMountains.TopDownEngine.Magnetic.Target |
the target to follow, read only, for debug only
◆ TargetLayerMask
| LayerMask MoreMountains.TopDownEngine.Magnetic.TargetLayerMask = LayerManager.PlayerLayerMask |
the layermask this magnetic element is attracted to
◆ UpdateMode
the update at which the movement happens
The documentation for this class was generated from the following file:
- H:/Code/MoreMountains/topdownengine/Assets/TopDownEngine/Common/Scripts/Environment/Magnetic.cs