Corgi Engine  v8.8
MoreMountains.CorgiEngine.ForceZone Class Reference

Add this zone to a trigger collider 2D and it'll let you apply the specified force to any Corgi Controller that enters it More...

Inheritance diagram for MoreMountains.CorgiEngine.ForceZone:
MoreMountains.CorgiEngine.CorgiMonoBehaviour

Public Types

enum  ForceModes { ForceModes.AddForce, ForceModes.SetForce }
 whether to add a force to controllers inside the zone, or to set the force More...
 
enum  ApplicationModes { ApplicationModes.TriggerEnter, ApplicationModes.TriggerStay, ApplicationModes.TriggerExit }
 whether the force should be applied on enter, on stay or on exit. If on stay, the force will be multiplied by delta time More...
 

Public Attributes

bool AutoTriggerSetup = true
 if this is true, the zone will force its collider to true on awake More...
 
ApplicationModes ApplicationMode = ApplicationModes.TriggerEnter
 whether to add a force to controllers inside the zone, or to set the force More...
 
ForceModes ForceMode = ForceModes.AddForce
 whether the force should be applied on enter, on stay or on exit. If on stay, the force will be multiplied by delta time More...
 
Vector2 AddedForce = Vector2.zero
 the amount of force to add to a CorgiController walking over this surface More...
 
Vector2 ForceApplicationCooldownDuration = new Vector2(0f, 0.25f)
 the cooldown to apply (in seconds) between two force applications, on x and y forces respectively More...
 
bool ResetForces = true
 whether or not the zone should reset forces on the controller (on entry or exit only) More...
 

Protected Member Functions

virtual void Awake ()
 On Awake we initialize our zone More...
 
virtual void Initialization ()
 On init, we force our collider's trigger settings to true if needed More...
 
virtual void OnTriggerEnter2D (Collider2D collider)
 When something triggers with our zone, we apply force More...
 
virtual void OnTriggerExit2D (Collider2D collider)
 
virtual void OnTriggerStay2D (Collider2D collider)
 
virtual void HandleForce (Collider2D collider)
 Makes sure we have a controller, resets forces if needed, applies horizontal and vertical force if needed More...
 

Protected Attributes

Collider2D _collider2D
 
CorgiController _controller
 
Vector2 _lastForceAppliedAt = Vector2.zero
 

Detailed Description

Add this zone to a trigger collider 2D and it'll let you apply the specified force to any Corgi Controller that enters it

Member Enumeration Documentation

◆ ApplicationModes

whether the force should be applied on enter, on stay or on exit. If on stay, the force will be multiplied by delta time

Enumerator
TriggerEnter 
TriggerStay 
TriggerExit 

◆ ForceModes

whether to add a force to controllers inside the zone, or to set the force

Enumerator
AddForce 
SetForce 

Member Function Documentation

◆ Awake()

virtual void MoreMountains.CorgiEngine.ForceZone.Awake ( )
protectedvirtual

On Awake we initialize our zone

◆ HandleForce()

virtual void MoreMountains.CorgiEngine.ForceZone.HandleForce ( Collider2D  collider)
protectedvirtual

Makes sure we have a controller, resets forces if needed, applies horizontal and vertical force if needed

Parameters
collider

◆ Initialization()

virtual void MoreMountains.CorgiEngine.ForceZone.Initialization ( )
protectedvirtual

On init, we force our collider's trigger settings to true if needed

◆ OnTriggerEnter2D()

virtual void MoreMountains.CorgiEngine.ForceZone.OnTriggerEnter2D ( Collider2D  collider)
protectedvirtual

When something triggers with our zone, we apply force

Parameters
collider

◆ OnTriggerExit2D()

virtual void MoreMountains.CorgiEngine.ForceZone.OnTriggerExit2D ( Collider2D  collider)
protectedvirtual

◆ OnTriggerStay2D()

virtual void MoreMountains.CorgiEngine.ForceZone.OnTriggerStay2D ( Collider2D  collider)
protectedvirtual

Member Data Documentation

◆ _collider2D

Collider2D MoreMountains.CorgiEngine.ForceZone._collider2D
protected

◆ _controller

CorgiController MoreMountains.CorgiEngine.ForceZone._controller
protected

◆ _lastForceAppliedAt

Vector2 MoreMountains.CorgiEngine.ForceZone._lastForceAppliedAt = Vector2.zero
protected

◆ AddedForce

Vector2 MoreMountains.CorgiEngine.ForceZone.AddedForce = Vector2.zero

the amount of force to add to a CorgiController walking over this surface

◆ ApplicationMode

ApplicationModes MoreMountains.CorgiEngine.ForceZone.ApplicationMode = ApplicationModes.TriggerEnter

whether to add a force to controllers inside the zone, or to set the force

◆ AutoTriggerSetup

bool MoreMountains.CorgiEngine.ForceZone.AutoTriggerSetup = true

if this is true, the zone will force its collider to true on awake

◆ ForceApplicationCooldownDuration

Vector2 MoreMountains.CorgiEngine.ForceZone.ForceApplicationCooldownDuration = new Vector2(0f, 0.25f)

the cooldown to apply (in seconds) between two force applications, on x and y forces respectively

◆ ForceMode

ForceModes MoreMountains.CorgiEngine.ForceZone.ForceMode = ForceModes.AddForce

whether the force should be applied on enter, on stay or on exit. If on stay, the force will be multiplied by delta time

◆ ResetForces

bool MoreMountains.CorgiEngine.ForceZone.ResetForces = true

whether or not the zone should reset forces on the controller (on entry or exit only)


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