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

Add this component to an object and it'll become carryable by a Character with the appropriate ability (CharacterGrabCarryAndThrow) More...

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

Public Types

enum  CarryMethods { CarryMethods.Parent, CarryMethods.Follow }
 

Public Member Functions

virtual void Grab (Transform targetParent)
 Triggered when this objects starts being carried Attaches to the grabber, and sets state More...
 
virtual void Throw (int direction, float forceMultiplier)
 Triggered when this object gets thrown More...
 

Public Attributes

CarryMethods CarryMethod = CarryMethods.Parent
 the selected carry method More...
 
Vector3 CarryOffset = Vector3.zero
 the offset to apply when attaching the object to the character More...
 
string CarryLayerMask = "Projectiles"
 the mask the object should be moved to while carried More...
 
int CarryingAnimationID = 0
 an ID that will get passed to the Character's animator when this object is carried. Use it to differentiate objects to get different carry animations More...
 
bool Carried = false
 whether this object is being carried this frame or not More...
 
Vector2 ThrowDirection = new Vector2(1f, 0.25f)
 the direction the object should be thrown in if the Character is facing right (x will be reversed for left facing throws) More...
 
float Force = 1f
 the force at which this object should be thrown More...
 
ForceMode2D ForceMode = ForceMode2D.Impulse
 the force mode to apply when throwing More...
 
float ThrowColliderCooldown = 0.2f
 the cooldown (in seconds) after which to reset the layer and scale of our object after a throw More...
 
float Recoil = 0f
 the recoil to apply to the throwing Character after a throw More...
 
UnityEvent OnGrabbed
 a UnityEvent triggered when the object gets grabbed More...
 
UnityEvent OnThrown
 a UnityEvent triggered when the object gets thrown More...
 

Protected Member Functions

virtual void Awake ()
 On Awake we initialize our object More...
 
virtual void Initialization ()
 Grabs and stores components More...
 
virtual IEnumerator ResetCollisions ()
 An internal coroutine used to reset collisions after a throw More...
 

Protected Attributes

Rigidbody2D _rigidbody2D
 
Vector2 _throwVector
 
WaitForSeconds _throwColliderCooldownWaitForSeconds
 
int _originalLayer
 
Vector3 _originalScale
 
MMFollowTarget _followTarget
 

Detailed Description

Add this component to an object and it'll become carryable by a Character with the appropriate ability (CharacterGrabCarryAndThrow)

Member Enumeration Documentation

◆ CarryMethods

The possible ways this object can be carried :

  • Parent : the object gets parented to the Character, optionnally under a specified transform
  • Follow : the object uses an additional MMFollowTarget component (you'll need to add it) to smoothly follow the Character
Enumerator
Parent 
Follow 

Member Function Documentation

◆ Awake()

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

On Awake we initialize our object

◆ Grab()

virtual void MoreMountains.CorgiEngine.GrabCarryAndThrowObject.Grab ( Transform  targetParent)
virtual

Triggered when this objects starts being carried Attaches to the grabber, and sets state

Parameters
targetParent

◆ Initialization()

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

Grabs and stores components

◆ ResetCollisions()

virtual IEnumerator MoreMountains.CorgiEngine.GrabCarryAndThrowObject.ResetCollisions ( )
protectedvirtual

An internal coroutine used to reset collisions after a throw

Returns

◆ Throw()

virtual void MoreMountains.CorgiEngine.GrabCarryAndThrowObject.Throw ( int  direction,
float  forceMultiplier 
)
virtual

Triggered when this object gets thrown

Parameters
direction
forceMultiplier

Member Data Documentation

◆ _followTarget

MMFollowTarget MoreMountains.CorgiEngine.GrabCarryAndThrowObject._followTarget
protected

◆ _originalLayer

int MoreMountains.CorgiEngine.GrabCarryAndThrowObject._originalLayer
protected

◆ _originalScale

Vector3 MoreMountains.CorgiEngine.GrabCarryAndThrowObject._originalScale
protected

◆ _rigidbody2D

Rigidbody2D MoreMountains.CorgiEngine.GrabCarryAndThrowObject._rigidbody2D
protected

◆ _throwColliderCooldownWaitForSeconds

WaitForSeconds MoreMountains.CorgiEngine.GrabCarryAndThrowObject._throwColliderCooldownWaitForSeconds
protected

◆ _throwVector

Vector2 MoreMountains.CorgiEngine.GrabCarryAndThrowObject._throwVector
protected

◆ Carried

bool MoreMountains.CorgiEngine.GrabCarryAndThrowObject.Carried = false

whether this object is being carried this frame or not

◆ CarryingAnimationID

int MoreMountains.CorgiEngine.GrabCarryAndThrowObject.CarryingAnimationID = 0

an ID that will get passed to the Character's animator when this object is carried. Use it to differentiate objects to get different carry animations

◆ CarryLayerMask

string MoreMountains.CorgiEngine.GrabCarryAndThrowObject.CarryLayerMask = "Projectiles"

the mask the object should be moved to while carried

◆ CarryMethod

CarryMethods MoreMountains.CorgiEngine.GrabCarryAndThrowObject.CarryMethod = CarryMethods.Parent

the selected carry method

◆ CarryOffset

Vector3 MoreMountains.CorgiEngine.GrabCarryAndThrowObject.CarryOffset = Vector3.zero

the offset to apply when attaching the object to the character

◆ Force

float MoreMountains.CorgiEngine.GrabCarryAndThrowObject.Force = 1f

the force at which this object should be thrown

◆ ForceMode

ForceMode2D MoreMountains.CorgiEngine.GrabCarryAndThrowObject.ForceMode = ForceMode2D.Impulse

the force mode to apply when throwing

◆ OnGrabbed

UnityEvent MoreMountains.CorgiEngine.GrabCarryAndThrowObject.OnGrabbed

a UnityEvent triggered when the object gets grabbed

◆ OnThrown

UnityEvent MoreMountains.CorgiEngine.GrabCarryAndThrowObject.OnThrown

a UnityEvent triggered when the object gets thrown

◆ Recoil

float MoreMountains.CorgiEngine.GrabCarryAndThrowObject.Recoil = 0f

the recoil to apply to the throwing Character after a throw

◆ ThrowColliderCooldown

float MoreMountains.CorgiEngine.GrabCarryAndThrowObject.ThrowColliderCooldown = 0.2f

the cooldown (in seconds) after which to reset the layer and scale of our object after a throw

◆ ThrowDirection

Vector2 MoreMountains.CorgiEngine.GrabCarryAndThrowObject.ThrowDirection = new Vector2(1f, 0.25f)

the direction the object should be thrown in if the Character is facing right (x will be reversed for left facing throws)


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