Corgi Engine  v9.1
MoreMountains.CorgiEngine.SurfaceModifier Class Reference

Add this component to a platform and define its new friction or force which will be applied to any CorgiController that walks on it More...

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

Public Types

enum  ForceApplicationModes { ForceApplicationModes.AddForce, ForceApplicationModes.SetForce }
 the possible modes this surface can apply forces More...
 

Public Member Functions

virtual void OnTriggerStay2D (Collider2D collider)
 Triggered when a CorgiController collides with the surface More...
 

Public Attributes

float Friction
 the amount of friction to apply to a CorgiController walking over this surface
More...
 
ForceApplicationModes ForceApplicationMode = ForceApplicationModes.AddForce
 the chosen mode to use to apply force. Add will add to existing forces, Set will force that specific value, ignoring current forces. More...
 
Vector2 AddedForce = Vector2.zero
 the amount of force to add to a CorgiController walking over this surface More...
 
bool OnlyApplyForceIfGrounded = false
 if this is true, the force will only be applied if the colliding character is grounded 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 ResetForcesOnExit = false
 whether or not to reset forces when an object exits the surface, useful when moving inactive objects More...
 

Protected Member Functions

virtual void Awake ()
 On awake we initialize our list of targets More...
 
virtual void OnTriggerExit2D (Collider2D collider)
 On trigger exit, we lose all reference to the controller and character More...
 
virtual void Update ()
 On Update, we make sure we have a controller and a live character, and if we do, we apply a force to it More...
 
virtual void ProcessSurface ()
 A method used to go through all targets and apply force if needed More...
 
virtual bool ForceApplicationConditionsMet ()
 This method returns true if conditions to apply force are met More...
 
virtual void ApplyHorizontalForce (SurfaceModifierTarget target)
 This method applies horizontal forces if needed More...
 
virtual void ApplyVerticalForce (SurfaceModifierTarget target)
 This method applies vertical forces if needed More...
 

Protected Attributes

CorgiController _controller
 
Character _character
 

Properties

List< SurfaceModifierTarget_targets [get, set]
 a list of all the targets currently impacted by this surface modifier More...
 

Detailed Description

Add this component to a platform and define its new friction or force which will be applied to any CorgiController that walks on it

Member Enumeration Documentation

◆ ForceApplicationModes

the possible modes this surface can apply forces

Enumerator
AddForce 
SetForce 

Member Function Documentation

◆ ApplyHorizontalForce()

virtual void MoreMountains.CorgiEngine.SurfaceModifier.ApplyHorizontalForce ( SurfaceModifierTarget  target)
protectedvirtual

This method applies horizontal forces if needed

Parameters
target

◆ ApplyVerticalForce()

virtual void MoreMountains.CorgiEngine.SurfaceModifier.ApplyVerticalForce ( SurfaceModifierTarget  target)
protectedvirtual

This method applies vertical forces if needed

Parameters
target

◆ Awake()

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

On awake we initialize our list of targets

◆ ForceApplicationConditionsMet()

virtual bool MoreMountains.CorgiEngine.SurfaceModifier.ForceApplicationConditionsMet ( )
protectedvirtual

This method returns true if conditions to apply force are met

Returns

◆ OnTriggerExit2D()

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

On trigger exit, we lose all reference to the controller and character

Parameters
collision

◆ OnTriggerStay2D()

virtual void MoreMountains.CorgiEngine.SurfaceModifier.OnTriggerStay2D ( Collider2D  collider)
virtual

Triggered when a CorgiController collides with the surface

Parameters
colliderCollider.

◆ ProcessSurface()

virtual void MoreMountains.CorgiEngine.SurfaceModifier.ProcessSurface ( )
protectedvirtual

A method used to go through all targets and apply force if needed

◆ Update()

virtual void MoreMountains.CorgiEngine.SurfaceModifier.Update ( )
protectedvirtual

On Update, we make sure we have a controller and a live character, and if we do, we apply a force to it

Member Data Documentation

◆ _character

Character MoreMountains.CorgiEngine.SurfaceModifier._character
protected

◆ _controller

CorgiController MoreMountains.CorgiEngine.SurfaceModifier._controller
protected

◆ AddedForce

Vector2 MoreMountains.CorgiEngine.SurfaceModifier.AddedForce = Vector2.zero

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

◆ ForceApplicationCooldownDuration

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

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

◆ ForceApplicationMode

ForceApplicationModes MoreMountains.CorgiEngine.SurfaceModifier.ForceApplicationMode = ForceApplicationModes.AddForce

the chosen mode to use to apply force. Add will add to existing forces, Set will force that specific value, ignoring current forces.

◆ Friction

float MoreMountains.CorgiEngine.SurfaceModifier.Friction

the amount of friction to apply to a CorgiController walking over this surface

◆ OnlyApplyForceIfGrounded

bool MoreMountains.CorgiEngine.SurfaceModifier.OnlyApplyForceIfGrounded = false

if this is true, the force will only be applied if the colliding character is grounded

◆ ResetForcesOnExit

bool MoreMountains.CorgiEngine.SurfaceModifier.ResetForcesOnExit = false

whether or not to reset forces when an object exits the surface, useful when moving inactive objects

Property Documentation

◆ _targets

List<SurfaceModifierTarget> MoreMountains.CorgiEngine.SurfaceModifier._targets
getset

a list of all the targets currently impacted by this surface modifier


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