Corgi Engine v9.4
Loading...
Searching...
No Matches
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.
override void UpdateAnimator ()
 At the end of each cycle, we update our animator parameters with our current state.
override void ResetAbility ()
 On reset ability, we cancel all the changes made.
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.
virtual void BindAnimator ()
 Binds the animator from the character and initializes the animator parameters.
virtual void ResetInput ()
 Resets all input for this ability. Can be overridden for ability specific directives.
virtual void EarlyProcessAbility ()
 The first of the 3 passes you can have in your ability. Think of it as EarlyUpdate() if it existed.
virtual void ProcessAbility ()
 The second of the 3 passes you can have in your ability. Think of it as Update()
virtual void LateProcessAbility ()
 The last of the 3 passes you can have in your ability. Think of it as LateUpdate()
virtual void PermitAbility (bool abilityPermitted)
 Changes the status of the ability's permission.
virtual void Flip ()
 Override this to specify what should happen in this ability when the character flips.
virtual void PlayAbilityStartFeedbacks ()
 Plays the ability start feedback.
virtual void StopStartFeedbacks ()
 Stops the ability used feedback.
virtual void PlayAbilityStopFeedbacks ()
 Plays the ability stop feedback.
virtual void RegisterAnimatorParameter (string parameterName, AnimatorControllerParameterType parameterType, out int parameter)
 Registers a new animator parameter to the list.

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
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
bool Grabbing = false
 whether or not this Character is grabbing something right now
Transform CarryParent
 a Transform used to attach carried objects to
bool Carrying = false
 whether or not this Character is carrying an object this frame
int CarryingID = -1
 the ID of the object being carried
GrabCarryAndThrowObject CarriedObject = null
 a reference to the object being carried
float ThrowForce = 1f
 the force to apply when throwing
float RecoilModifier = 1f
 a modifier to apply to the recoil set on the object
bool Throwing = false
 whether or not this Character is throwing something this frame
bool PreventThrowIfCarryingOnGrab = false
 whether or not to allow the character to throw if next to a grabbable object
Public Attributes inherited from MoreMountains.CorgiEngine.CharacterAbility
MMFeedbacks AbilityStartFeedbacks
 the feedbacks to play when the ability starts
MMFeedbacks AbilityStopFeedbacks
 the feedbacks to play when the ability stops
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
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.
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.
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.

Protected Member Functions

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

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
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

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

◆ GetGrababbleObject()

virtual GrabCarryAndThrowObject MoreMountains.CorgiEngine.CharacterGrabCarryAndThrow.GetGrababbleObject ( )
protectedvirtual

◆ 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

◆ PreventThrowIfCarryingOnGrab

bool MoreMountains.CorgiEngine.CharacterGrabCarryAndThrow.PreventThrowIfCarryingOnGrab = false

whether or not to allow the character to throw if next to a grabbable object

◆ 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: