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

Add this component to a character and it'll be able to control an inventory Animator parameters : none Note that its start feedback will play on weapon change More...

Inheritance diagram for MoreMountains.CorgiEngine.CharacterInventory:
MoreMountains.CorgiEngine.CharacterAbility MoreMountains.Tools.MMEventListener< MMInventoryEvent > MoreMountains.Tools.MMEventListener< CorgiEngineEvent > MoreMountains.CorgiEngine.CorgiMonoBehaviour

Classes

struct  InventoryItemsToAdd
 A struct used to store inventory items to add on init More...
 

Public Types

enum  WeaponRotationModes { WeaponRotationModes.Normal, WeaponRotationModes.AddEmptySlot, WeaponRotationModes.AddInitialWeapon }
 

Public Member Functions

override void ProcessAbility ()
 On process ability, we equip our next weapon if needed More...
 
virtual void OnMMEvent (MMInventoryEvent inventoryEvent)
 Watches for InventoryLoaded events When an inventory gets loaded, if it's our WeaponInventory, we check if there's already a weapon equipped, and if yes, we equip it More...
 
virtual void OnMMEvent (CorgiEngineEvent corgiEngineEvent)
 When we detect a character switch, we equip the current weapon if AutoEquipWeaponOnCharacterSwitch is true More...
 
- Public Member Functions inherited from MoreMountains.CorgiEngine.CharacterAbility
virtual string HelpBoxText ()
 This method is only used to display a helpbox text at the beginning of the ability's inspector. More...
 
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 LateProcessAbility ()
 The last of the 3 passes you can have in your ability. Think of it as LateUpdate() More...
 
virtual void UpdateAnimator ()
 Override this to send parameters to the character's animator. This is called once per cycle, by the Character class, after Early, normal and Late process(). 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 ResetAbility ()
 Override this to reset this ability's parameters. It'll be automatically called when the character gets killed, in anticipation for its respawn. 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 Member Functions inherited from MoreMountains.Tools.MMEventListener< MMInventoryEvent >
void OnMMEvent (T eventType)
 
- Public Member Functions inherited from MoreMountains.Tools.MMEventListener< CorgiEngineEvent >
void OnMMEvent (T eventType)
 

Public Attributes

string PlayerID = "Player1"
 the unique ID of this player as far as the InventoryEngine is concerned. This has to match all its Inventory and InventoryEngine UI components' PlayerID for that player. If you're not going for multiplayer here, just leave Player1. More...
 
string MainInventoryName
 the name of the main inventory More...
 
string WeaponInventoryName
 the name of the weapon inventory More...
 
string HotbarInventoryName
 the name of the hotbar inventory More...
 
bool AutoEquipWeaponOnCharacterSwitch
 if this is true, when switching to this character, if there's a main weapon equipped, it'll be equipped More...
 
WeaponRotationModes WeaponRotationMode = WeaponRotationModes.Normal
 the rotation mode for weapons : Normal will cycle through all weapons, AddEmptySlot will return to empty hands, AddOriginalWeapon will cycle back to the original weapon More...
 
CharacterHandleWeapon CharacterHandleWeapon
 the target handle weapon ability - if left empty, will pick the first one it finds More...
 
Transform InventoryTransform
 a transform to pass to the inventories, will be passed to the inventories and used as reference for drops. If left empty, this.transform will be used. More...
 
List< InventoryItemsToAddAutoAddItemsMainInventory
 a list of items and associated quantities to add to the main inventory More...
 
List< InventoryItemsToAddAutoAddItemsHotbar
 a list of items to add to the hotbar More...
 
InventoryEngineWeapon AutoEquipWeapon
 a weapon to automatically add to the inventory and equip on init More...
 
List< string > AvailableWeaponsIDs => _availableWeaponsIDs
 
- 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 trigger our setup More...
 
virtual void Setup ()
 Setup grabs inventories, component, and fills the weapon lists More...
 
virtual IEnumerator AutoAddAndEquip ()
 Automatically adds items and equips a weapon if needed More...
 
virtual void GrabInventories ()
 Grabs references to all inventories More...
 
override void HandleInput ()
 We watch for a switch weapon input More...
 
virtual void FillAvailableWeaponsLists ()
 Fills a list with all available weapons in the inventories More...
 
virtual void DetermineNextWeaponName ()
 Determines the name of the next weapon More...
 
virtual void EquipWeapon (string weaponID)
 Equips a weapon specified in parameters More...
 
virtual void SwitchWeapon ()
 Switches to the next weapon in line More...
 
override void OnEnable ()
 On enable, we start listening for MMGameEvents. You may want to extend that to listen to other types of events. More...
 
override void OnDisable ()
 On disable, we stop listening for MMGameEvents. You may want to extend that to stop listening to other types of events. More...
 
- Protected Member Functions inherited from MoreMountains.CorgiEngine.CharacterAbility
virtual void Start ()
 On Start(), we call the ability's intialization More...
 
virtual void InitializeAnimatorParameters ()
 Adds required animator parameters to the animator parameters list if they exist 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...
 

Protected Attributes

List< int > _availableWeapons
 
List< string > _availableWeaponsIDs
 
string _nextWeaponID
 
bool _nextFrameWeapon = false
 
string _nextFrameWeaponName
 
bool _autoAdded = false
 
- 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 _emptySlotWeaponName = "_EmptySlotWeaponName"
 
const string _initialSlotWeaponName = "_InitialSlotWeaponName"
 

Properties

Inventory MainInventory [get, set]
 the reference to the main inventory More...
 
Inventory WeaponInventory [get, set]
 the reference to the weapon inventory More...
 
Inventory HotbarInventory [get, set]
 the reference to the hotbar inventory More...
 
- 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

Add this component to a character and it'll be able to control an inventory Animator parameters : none Note that its start feedback will play on weapon change

Member Enumeration Documentation

◆ WeaponRotationModes

Enumerator
Normal 
AddEmptySlot 
AddInitialWeapon 

Member Function Documentation

◆ AutoAddAndEquip()

virtual IEnumerator MoreMountains.CorgiEngine.CharacterInventory.AutoAddAndEquip ( )
protectedvirtual

Automatically adds items and equips a weapon if needed

Returns

◆ DetermineNextWeaponName()

virtual void MoreMountains.CorgiEngine.CharacterInventory.DetermineNextWeaponName ( )
protectedvirtual

Determines the name of the next weapon

◆ EquipWeapon()

virtual void MoreMountains.CorgiEngine.CharacterInventory.EquipWeapon ( string  weaponID)
protectedvirtual

Equips a weapon specified in parameters

Parameters
weaponID

◆ FillAvailableWeaponsLists()

virtual void MoreMountains.CorgiEngine.CharacterInventory.FillAvailableWeaponsLists ( )
protectedvirtual

Fills a list with all available weapons in the inventories

◆ GrabInventories()

virtual void MoreMountains.CorgiEngine.CharacterInventory.GrabInventories ( )
protectedvirtual

Grabs references to all inventories

◆ HandleInput()

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

We watch for a switch weapon input

Reimplemented from MoreMountains.CorgiEngine.CharacterAbility.

◆ Initialization()

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

On init, we trigger our setup

Reimplemented from MoreMountains.CorgiEngine.CharacterAbility.

◆ OnDisable()

override void MoreMountains.CorgiEngine.CharacterInventory.OnDisable ( )
protectedvirtual

On disable, we stop listening for MMGameEvents. You may want to extend that to stop listening to other types of events.

Reimplemented from MoreMountains.CorgiEngine.CharacterAbility.

◆ OnEnable()

override void MoreMountains.CorgiEngine.CharacterInventory.OnEnable ( )
protectedvirtual

On enable, we start listening for MMGameEvents. You may want to extend that to listen to other types of events.

Reimplemented from MoreMountains.CorgiEngine.CharacterAbility.

◆ OnMMEvent() [1/2]

virtual void MoreMountains.CorgiEngine.CharacterInventory.OnMMEvent ( CorgiEngineEvent  corgiEngineEvent)
virtual

When we detect a character switch, we equip the current weapon if AutoEquipWeaponOnCharacterSwitch is true

Parameters
corgiEngineEvent

◆ OnMMEvent() [2/2]

virtual void MoreMountains.CorgiEngine.CharacterInventory.OnMMEvent ( MMInventoryEvent  inventoryEvent)
virtual

Watches for InventoryLoaded events When an inventory gets loaded, if it's our WeaponInventory, we check if there's already a weapon equipped, and if yes, we equip it

Parameters
inventoryEventInventory event.

◆ ProcessAbility()

override void MoreMountains.CorgiEngine.CharacterInventory.ProcessAbility ( )
virtual

On process ability, we equip our next weapon if needed

Reimplemented from MoreMountains.CorgiEngine.CharacterAbility.

◆ Setup()

virtual void MoreMountains.CorgiEngine.CharacterInventory.Setup ( )
protectedvirtual

Setup grabs inventories, component, and fills the weapon lists

◆ SwitchWeapon()

virtual void MoreMountains.CorgiEngine.CharacterInventory.SwitchWeapon ( )
protectedvirtual

Switches to the next weapon in line

Member Data Documentation

◆ _autoAdded

bool MoreMountains.CorgiEngine.CharacterInventory._autoAdded = false
protected

◆ _availableWeapons

List<int> MoreMountains.CorgiEngine.CharacterInventory._availableWeapons
protected

◆ _availableWeaponsIDs

List<string> MoreMountains.CorgiEngine.CharacterInventory._availableWeaponsIDs
protected

◆ _emptySlotWeaponName

const string MoreMountains.CorgiEngine.CharacterInventory._emptySlotWeaponName = "_EmptySlotWeaponName"
staticprotected

◆ _initialSlotWeaponName

const string MoreMountains.CorgiEngine.CharacterInventory._initialSlotWeaponName = "_InitialSlotWeaponName"
staticprotected

◆ _nextFrameWeapon

bool MoreMountains.CorgiEngine.CharacterInventory._nextFrameWeapon = false
protected

◆ _nextFrameWeaponName

string MoreMountains.CorgiEngine.CharacterInventory._nextFrameWeaponName
protected

◆ _nextWeaponID

string MoreMountains.CorgiEngine.CharacterInventory._nextWeaponID
protected

◆ AutoAddItemsHotbar

List<InventoryItemsToAdd> MoreMountains.CorgiEngine.CharacterInventory.AutoAddItemsHotbar

a list of items to add to the hotbar

◆ AutoAddItemsMainInventory

List<InventoryItemsToAdd> MoreMountains.CorgiEngine.CharacterInventory.AutoAddItemsMainInventory

a list of items and associated quantities to add to the main inventory

◆ AutoEquipWeapon

InventoryEngineWeapon MoreMountains.CorgiEngine.CharacterInventory.AutoEquipWeapon

a weapon to automatically add to the inventory and equip on init

◆ AutoEquipWeaponOnCharacterSwitch

bool MoreMountains.CorgiEngine.CharacterInventory.AutoEquipWeaponOnCharacterSwitch

if this is true, when switching to this character, if there's a main weapon equipped, it'll be equipped

◆ AvailableWeaponsIDs

List<string> MoreMountains.CorgiEngine.CharacterInventory.AvailableWeaponsIDs => _availableWeaponsIDs

◆ CharacterHandleWeapon

CharacterHandleWeapon MoreMountains.CorgiEngine.CharacterInventory.CharacterHandleWeapon

the target handle weapon ability - if left empty, will pick the first one it finds

◆ HotbarInventoryName

string MoreMountains.CorgiEngine.CharacterInventory.HotbarInventoryName

the name of the hotbar inventory

◆ InventoryTransform

Transform MoreMountains.CorgiEngine.CharacterInventory.InventoryTransform

a transform to pass to the inventories, will be passed to the inventories and used as reference for drops. If left empty, this.transform will be used.

◆ MainInventoryName

string MoreMountains.CorgiEngine.CharacterInventory.MainInventoryName

the name of the main inventory

◆ PlayerID

string MoreMountains.CorgiEngine.CharacterInventory.PlayerID = "Player1"

the unique ID of this player as far as the InventoryEngine is concerned. This has to match all its Inventory and InventoryEngine UI components' PlayerID for that player. If you're not going for multiplayer here, just leave Player1.

◆ WeaponInventoryName

string MoreMountains.CorgiEngine.CharacterInventory.WeaponInventoryName

the name of the weapon inventory

◆ WeaponRotationMode

WeaponRotationModes MoreMountains.CorgiEngine.CharacterInventory.WeaponRotationMode = WeaponRotationModes.Normal

the rotation mode for weapons : Normal will cycle through all weapons, AddEmptySlot will return to empty hands, AddOriginalWeapon will cycle back to the original weapon

Property Documentation

◆ HotbarInventory

Inventory MoreMountains.CorgiEngine.CharacterInventory.HotbarInventory
getset

the reference to the hotbar inventory

◆ MainInventory

Inventory MoreMountains.CorgiEngine.CharacterInventory.MainInventory
getset

the reference to the main inventory

◆ WeaponInventory

Inventory MoreMountains.CorgiEngine.CharacterInventory.WeaponInventory
getset

the reference to the weapon inventory


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