Platformer Pro  2.3.2
A platform game kit for Unity.
PlatformerPro.NoAllocationSmartSidecast Class Reference

A raycast collider specifically for the sides. It uses the character reference to provide smarter collisions. More...

Inheritance diagram for PlatformerPro.NoAllocationSmartSidecast:
PlatformerPro.BasicRaycast PlatformerPro.IRaycastColliderWithIMob

Public Member Functions

override RaycastHit2D GetRaycastHit ()
 Get the first raycast hit. More...
 
override RaycastHit2D[] GetRaycastHits ()
 Get all raycast hits. More...
 
- Public Member Functions inherited from PlatformerPro.BasicRaycast
virtual Vector2 GetDirection ()
 Gets the direction for the raycast. More...
 

Protected Member Functions

override void Init ()
 Set up the raycasts. More...
 
virtual int CountBits (int layerMask)
 Counts the bits that are set to 1 in the LayerMask More...
 

Protected Attributes

RaycastHit2D[] hits
 Cached array of hits. More...
 
IMob character
 The character reference. More...
 
RaycastHit2D emptyRaycastHit = new RaycastHit2D()
 Store an empty raycast hit. More...
 
- Protected Attributes inherited from PlatformerPro.BasicRaycast
Transform transform
 Stores the transform from which the ray position is relative to. Most collider will use the characters transform which is set on Init(). More...
 
float length
 The length of the ray. More...
 
RaycastType raycastType
 The type of raycast. More...
 
float lookAhead
 The additional length to add to the ray to "look ahead" for special conditions. More...
 
Vector2 extent
 The position the ray is cast from (relative to transform). More...
 
int layerMask
 The layer mask. More...
 

Static Protected Attributes

const int MAX_HITS = 4
 The maximum number of raycasts to fire. More...
 
const int MAX_LAYER = 16
 The maximum layer to check. More...
 
const float minSideLength = 0.33f
 We need some minimum length to avoid issues at zero velocity. More...
 

Properties

IMob Mob [get, set]
 Reference to the chracter More...
 
override float Length [get, set]
 Calculate length based on characters velocity More...
 
override int LayerMask [get, set]
 Gets or sets the layer mask for the collision. More...
 
- Properties inherited from PlatformerPro.BasicRaycast
virtual bool Disabled [get, set]
 Enables or disables the collider. More...
 
virtual Transform Transform [get, set]
 Stores the transform from which the ray position is relative to. Usually the position of the character or one of the characters limbs. More...
 
virtual float Length [get, set]
 The length of the ray. More...
 
float RawLength [get]
 Gets the raw value of the length parameter. Required because smart colliders often change Length. More...
 
virtual float LookAhead [get, set]
 The additional length to add to the ray to "look ahead" for special conditions. More...
 
virtual RaycastType RaycastType [get, set]
 The type of raycast. More...
 
virtual Vector2 WorldPosition [get]
 The position the ray is cast from (relative to transform). More...
 
virtual int LayerMask [get, set]
 Gets or sets the layer mask for the collision. More...
 
virtual Vector2 Extent [get, set]
 Gets the extent of this collider relative to character position and rotation. For feet colliders the extent would be the offset to add to the character to find the bottom of the foot. More...
 
virtual Vector2 WorldExtent [get]
 Gets the extent of this collider in world space (i.e. with character transform applied). More...
 
- Properties inherited from PlatformerPro.IRaycastColliderWithIMob
IMob Mob [get, set]
 

Detailed Description

A raycast collider specifically for the sides. It uses the character reference to provide smarter collisions.

Member Function Documentation

◆ CountBits()

virtual int PlatformerPro.NoAllocationSmartSidecast.CountBits ( int  layerMask)
protectedvirtual

Counts the bits that are set to 1 in the LayerMask

Returns
The number of bits set to 1.

◆ GetRaycastHit()

override RaycastHit2D PlatformerPro.NoAllocationSmartSidecast.GetRaycastHit ( )
virtual

Get the first raycast hit.

Reimplemented from PlatformerPro.BasicRaycast.

◆ GetRaycastHits()

override RaycastHit2D [] PlatformerPro.NoAllocationSmartSidecast.GetRaycastHits ( )
virtual

Get all raycast hits.

Reimplemented from PlatformerPro.BasicRaycast.

◆ Init()

override void PlatformerPro.NoAllocationSmartSidecast.Init ( )
protectedvirtual

Set up the raycasts.

Reimplemented from PlatformerPro.BasicRaycast.

Member Data Documentation

◆ character

IMob PlatformerPro.NoAllocationSmartSidecast.character
protected

The character reference.

◆ emptyRaycastHit

RaycastHit2D PlatformerPro.NoAllocationSmartSidecast.emptyRaycastHit = new RaycastHit2D()
protected

Store an empty raycast hit.

◆ hits

RaycastHit2D [] PlatformerPro.NoAllocationSmartSidecast.hits
protected

Cached array of hits.

◆ MAX_HITS

const int PlatformerPro.NoAllocationSmartSidecast.MAX_HITS = 4
staticprotected

The maximum number of raycasts to fire.

◆ MAX_LAYER

const int PlatformerPro.NoAllocationSmartSidecast.MAX_LAYER = 16
staticprotected

The maximum layer to check.

◆ minSideLength

const float PlatformerPro.NoAllocationSmartSidecast.minSideLength = 0.33f
staticprotected

We need some minimum length to avoid issues at zero velocity.

Property Documentation

◆ LayerMask

override int PlatformerPro.NoAllocationSmartSidecast.LayerMask
getset

Gets or sets the layer mask for the collision.

The layer mask.

◆ Length

override float PlatformerPro.NoAllocationSmartSidecast.Length
getset

Calculate length based on characters velocity

The length.

◆ Mob

IMob PlatformerPro.NoAllocationSmartSidecast.Mob
getset

Reference to the chracter

The character.


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