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

This class lets you grab, carry and throw objects with a GrabCarryAndThrowObject component. More...

Inheritance diagram for MoreMountains.CorgiEngine.CharacterGrabCarryAndThrow:
MoreMountains.CorgiEngine.CharacterAbility MoreMountains.CorgiEngine.CorgiMonoBehaviour

Public Member Functions

override string HelpBoxText ()
 This method is only used to display a helpbox text at the beginning of the ability's inspector. More...
 
override void UpdateAnimator ()
 At the end of each cycle, we update our animator parameters with our current state More...
 
override void ResetAbility ()
 On reset ability, we cancel all the changes made More...
 
- Public Member Functions inherited from MoreMountains.CorgiEngine.CharacterAbility
virtual void SetInputManager (InputManager inputManager)
 Sets a new input manager for this ability to get input from More...
 
virtual void BindAnimator ()
 Binds the animator from the character and initializes the animator parameters More...
 
virtual void ResetInput ()
 Resets all input for this ability. Can be overridden for ability specific directives More...
 
virtual void EarlyProcessAbility ()
 The first of the 3 passes you can have in your ability. Think of it as EarlyUpdate() if it existed More...
 
virtual void ProcessAbility ()
 The second of the 3 passes you can have in your ability. Think of it as Update() More...
 
virtual void LateProcessAbility ()
 The last of the 3 passes you can have in your ability. Think of it as LateUpdate() More...
 
virtual void PermitAbility (bool abilityPermitted)
 Changes the status of the ability's permission More...
 
virtual void Flip ()
 Override this to specify what should happen in this ability when the character flips More...
 
virtual void PlayAbilityStartFeedbacks ()
 Plays the ability start sound effect More...
 
virtual void StopStartFeedbacks ()
 Stops the ability used sound effect More...
 
virtual void PlayAbilityStopFeedbacks ()
 Plays the ability stop sound effect More...
 
virtual void RegisterAnimatorParameter (string parameterName, AnimatorControllerParameterType parameterType, out int parameter)
 Registers a new animator parameter to the list More...
 

Public Attributes

Vector3 RaycastDirection = Vector3.down
 
float RaycastDistance = 1f
 the distance the grab raycast should cover (you'll want it bigger than half your Character's dimensions More...
 
LayerMask DetectionLayerMask = LayerManager.PlatformsLayerMask | LayerManager.EnemiesLayerMask
 the layer this grab raycast should look for objects on. This should match the layer you put your GrabCarryAndThrowObjects on More...
 
bool Grabbing = false
 whether or not this Character is grabbing something right now More...
 
Transform CarryParent
 a Transform used to attach carried objects to More...
 
bool Carrying = false
 whether or not this Character is carrying an object this frame More...
 
int CarryingID = -1
 the ID of the object being carried More...
 
GrabCarryAndThrowObject CarriedObject = null
 a reference to the object being carried More...
 
float ThrowForce = 1f
 the force to apply when throwing More...
 
float RecoilModifier = 1f
 a modifier to apply to the recoil set on the object More...
 
bool Throwing = false
 whether or not this Character is throwing something this frame More...
 
- Public Attributes inherited from MoreMountains.CorgiEngine.CharacterAbility
MMFeedbacks AbilityStartFeedbacks
 the feedbacks to play when the ability starts More...
 
MMFeedbacks AbilityStopFeedbacks
 the feedbacks to play when the ability stops More...
 
bool AbilityPermitted = true
 if true, this ability can perform as usual, if not, it'll be ignored. You can use this to unlock abilities over time for example More...
 
CharacterStates.MovementStates[] BlockingMovementStates
 an array containing all the blocking movement states. If the Character is in one of these states and tries to trigger this ability, it won't be permitted. Useful to prevent this ability from being used while Idle or Swimming, for example. More...
 
CharacterStates.CharacterConditions[] BlockingConditionStates
 an array containing all the blocking condition states. If the Character is in one of these states and tries to trigger this ability, it won't be permitted. Useful to prevent this ability from being used while dead, for example. More...
 
Weapon.WeaponStates[] BlockingWeaponStates
 an array containing all the blocking weapon states. If one of the character's weapons is in one of these states and yet the character tries to trigger this ability, it won't be permitted. Useful to prevent this ability from being used while attacking, for example. More...
 

Protected Member Functions

override void Initialization ()
 On init we set our CarryParent to the character transform if null More...
 
override void HandleInput ()
 Looks for throw and grab inputs More...
 
virtual void GrabAttempt ()
 Tries to grab by casting a raycast More...
 
virtual void Grab ()
 Sets the ability in carrying mode More...
 
virtual void Throw ()
 Throws the carried object More...
 
virtual void StopFeedbacks ()
 Stops all feedbacks More...
 
virtual void LateUpdate ()
 On late update we reset our states More...
 
override void InitializeAnimatorParameters ()
 Adds required animator parameters to the animator parameters list if they exist More...
 
- Protected Member Functions inherited from MoreMountains.CorgiEngine.CharacterAbility
virtual void Start ()
 On Start(), we call the ability's intialization More...
 
virtual void InternalHandleInput ()
 Internal method to check if an input manager is present or not More...
 
virtual void OnRespawn ()
 Override this to describe what should happen to this ability when the character respawns More...
 
virtual void OnDeath ()
 Override this to describe what should happen to this ability when the character respawns More...
 
virtual void OnHit ()
 Override this to describe what should happen to this ability when the character takes a hit More...
 
virtual void OnEnable ()
 On enable, we bind our respawn delegate More...
 
virtual void OnDisable ()
 On disable, we unbind our respawn delegate More...
 

Protected Attributes

Vector2 _raycastOrigin
 
Vector2 _recoilVector
 
int _grabbingAnimationParameter
 
int _carryingAnimationParameter
 
int _carryingIDAnimationParameter
 
int _throwingAnimationParameter
 
Vector3 _actualRaycastDirection
 
- Protected Attributes inherited from MoreMountains.CorgiEngine.CharacterAbility
Character _character
 
Transform _characterTransform
 
Health _health
 
CharacterHorizontalMovement _characterHorizontalMovement
 
CorgiController _controller
 
InputManager _inputManager
 
CameraController _sceneCamera
 
Animator _animator
 
CharacterStates _state
 
SpriteRenderer _spriteRenderer
 
MMStateMachine< CharacterStates.MovementStates_movement
 
MMStateMachine< CharacterStates.CharacterConditions_condition
 
bool _abilityInitialized = false
 
CharacterGravity _characterGravity
 
float _verticalInput
 
float _horizontalInput
 
bool _startFeedbackIsPlaying = false
 
List< CharacterHandleWeapon_handleWeaponList
 

Static Protected Attributes

const string _grabbingAnimationParameterName = "Grabbing"
 
const string _carryingAnimationParameterName = "Carrying"
 
const string _carryingIDAnimationParameterName = "CarryingID"
 
const string _throwingAnimationParameterName = "Throwing"
 

Additional Inherited Members

- Properties inherited from MoreMountains.CorgiEngine.CharacterAbility
virtual bool AbilityAuthorized [get]
 
virtual bool AbilityInitialized [get]
 true if the ability has already been initialized More...
 

Detailed Description

This class lets you grab, carry and throw objects with a GrabCarryAndThrowObject component.

Animation parameters :

  • Grabbing, boolean, triggered when an object is grabbed
  • Carrying : boolean, true if an object is being carried, false otherwise
  • CarryingID : int, set to whatever value is set on the carried object
  • Throwing, boolean, triggered when an object gets thrown

Member Function Documentation

◆ Grab()

virtual void MoreMountains.CorgiEngine.CharacterGrabCarryAndThrow.Grab ( )
protectedvirtual

Sets the ability in carrying mode

◆ GrabAttempt()

virtual void MoreMountains.CorgiEngine.CharacterGrabCarryAndThrow.GrabAttempt ( )
protectedvirtual

Tries to grab by casting a raycast

◆ HandleInput()

override void MoreMountains.CorgiEngine.CharacterGrabCarryAndThrow.HandleInput ( )
protectedvirtual

Looks for throw and grab inputs

Reimplemented from MoreMountains.CorgiEngine.CharacterAbility.

◆ HelpBoxText()

override string MoreMountains.CorgiEngine.CharacterGrabCarryAndThrow.HelpBoxText ( )
virtual

This method is only used to display a helpbox text at the beginning of the ability's inspector.

Reimplemented from MoreMountains.CorgiEngine.CharacterAbility.

◆ Initialization()

override void MoreMountains.CorgiEngine.CharacterGrabCarryAndThrow.Initialization ( )
protectedvirtual

On init we set our CarryParent to the character transform if null

Reimplemented from MoreMountains.CorgiEngine.CharacterAbility.

◆ InitializeAnimatorParameters()

override void MoreMountains.CorgiEngine.CharacterGrabCarryAndThrow.InitializeAnimatorParameters ( )
protectedvirtual

Adds required animator parameters to the animator parameters list if they exist

Reimplemented from MoreMountains.CorgiEngine.CharacterAbility.

◆ LateUpdate()

virtual void MoreMountains.CorgiEngine.CharacterGrabCarryAndThrow.LateUpdate ( )
protectedvirtual

On late update we reset our states

◆ ResetAbility()

override void MoreMountains.CorgiEngine.CharacterGrabCarryAndThrow.ResetAbility ( )
virtual

On reset ability, we cancel all the changes made

Reimplemented from MoreMountains.CorgiEngine.CharacterAbility.

◆ StopFeedbacks()

virtual void MoreMountains.CorgiEngine.CharacterGrabCarryAndThrow.StopFeedbacks ( )
protectedvirtual

Stops all feedbacks

◆ Throw()

virtual void MoreMountains.CorgiEngine.CharacterGrabCarryAndThrow.Throw ( )
protectedvirtual

Throws the carried object

◆ UpdateAnimator()

override void MoreMountains.CorgiEngine.CharacterGrabCarryAndThrow.UpdateAnimator ( )
virtual

At the end of each cycle, we update our animator parameters with our current state

Reimplemented from MoreMountains.CorgiEngine.CharacterAbility.

Member Data Documentation

◆ _actualRaycastDirection

Vector3 MoreMountains.CorgiEngine.CharacterGrabCarryAndThrow._actualRaycastDirection
protected

◆ _carryingAnimationParameter

int MoreMountains.CorgiEngine.CharacterGrabCarryAndThrow._carryingAnimationParameter
protected

◆ _carryingAnimationParameterName

const string MoreMountains.CorgiEngine.CharacterGrabCarryAndThrow._carryingAnimationParameterName = "Carrying"
staticprotected

◆ _carryingIDAnimationParameter

int MoreMountains.CorgiEngine.CharacterGrabCarryAndThrow._carryingIDAnimationParameter
protected

◆ _carryingIDAnimationParameterName

const string MoreMountains.CorgiEngine.CharacterGrabCarryAndThrow._carryingIDAnimationParameterName = "CarryingID"
staticprotected

◆ _grabbingAnimationParameter

int MoreMountains.CorgiEngine.CharacterGrabCarryAndThrow._grabbingAnimationParameter
protected

◆ _grabbingAnimationParameterName

const string MoreMountains.CorgiEngine.CharacterGrabCarryAndThrow._grabbingAnimationParameterName = "Grabbing"
staticprotected

◆ _raycastOrigin

Vector2 MoreMountains.CorgiEngine.CharacterGrabCarryAndThrow._raycastOrigin
protected

◆ _recoilVector

Vector2 MoreMountains.CorgiEngine.CharacterGrabCarryAndThrow._recoilVector
protected

◆ _throwingAnimationParameter

int MoreMountains.CorgiEngine.CharacterGrabCarryAndThrow._throwingAnimationParameter
protected

◆ _throwingAnimationParameterName

const string MoreMountains.CorgiEngine.CharacterGrabCarryAndThrow._throwingAnimationParameterName = "Throwing"
staticprotected

◆ CarriedObject

GrabCarryAndThrowObject MoreMountains.CorgiEngine.CharacterGrabCarryAndThrow.CarriedObject = null

a reference to the object being carried

◆ Carrying

bool MoreMountains.CorgiEngine.CharacterGrabCarryAndThrow.Carrying = false

whether or not this Character is carrying an object this frame

◆ CarryingID

int MoreMountains.CorgiEngine.CharacterGrabCarryAndThrow.CarryingID = -1

the ID of the object being carried

◆ CarryParent

Transform MoreMountains.CorgiEngine.CharacterGrabCarryAndThrow.CarryParent

a Transform used to attach carried objects to

◆ DetectionLayerMask

LayerMask MoreMountains.CorgiEngine.CharacterGrabCarryAndThrow.DetectionLayerMask = LayerManager.PlatformsLayerMask | LayerManager.EnemiesLayerMask

the layer this grab raycast should look for objects on. This should match the layer you put your GrabCarryAndThrowObjects on

◆ Grabbing

bool MoreMountains.CorgiEngine.CharacterGrabCarryAndThrow.Grabbing = false

whether or not this Character is grabbing something right now

◆ RaycastDirection

Vector3 MoreMountains.CorgiEngine.CharacterGrabCarryAndThrow.RaycastDirection = Vector3.down

the direction the raycast used to detect grabbable objects will be cast in (if the Character is facing right). Use Vector3.down for Mario2-like grabs from the top, or Vector3.right for side grabs for example.

◆ RaycastDistance

float MoreMountains.CorgiEngine.CharacterGrabCarryAndThrow.RaycastDistance = 1f

the distance the grab raycast should cover (you'll want it bigger than half your Character's dimensions

◆ RecoilModifier

float MoreMountains.CorgiEngine.CharacterGrabCarryAndThrow.RecoilModifier = 1f

a modifier to apply to the recoil set on the object

◆ ThrowForce

float MoreMountains.CorgiEngine.CharacterGrabCarryAndThrow.ThrowForce = 1f

the force to apply when throwing

◆ Throwing

bool MoreMountains.CorgiEngine.CharacterGrabCarryAndThrow.Throwing = false

whether or not this Character is throwing something this frame


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