TopDown Engine v4.5
Loading...
Searching...
No Matches
MoreMountains.InventoryEngine.InventoryDemoCharacter Class Reference

Demo character controller, very basic stuff. More...

Inheritance diagram for MoreMountains.InventoryEngine.InventoryDemoCharacter:
MoreMountains.Tools.MMEventListener< T > MoreMountains.Tools.MMEventListenerBase

Public Member Functions

virtual void SetMovement (float movementX, float movementY)
 Updates the character's movement values for this frame.
virtual void SetHorizontalMove (float value)
 Sets the horizontal move value.
virtual void SetVerticalMove (float value)
 Sets the vertical move value.
virtual void SetArmor (int index)
 Sets the current armor.
virtual void SetWeapon (Sprite newSprite, InventoryItem item)
 Sets the current weapon sprite.
virtual void OnMMEvent (MMInventoryEvent inventoryEvent)
 Catches MMInventoryEvents and if it's an "inventory loaded" one, equips the first armor and weapon stored in the corresponding inventories.
Public Member Functions inherited from MoreMountains.Tools.MMEventListener< T >
void OnMMEvent (T eventType)

Public Attributes

string PlayerID = "Player1"
float CharacterSpeed = 300f
 the character speed
SpriteRenderer WeaponSprite
 the sprite used to show the current weapon
Inventory ArmorInventory
 the armor inventory
Inventory WeaponInventory
 the weapon inventory

Protected Member Functions

virtual void Start ()
 On Start, we store the character's animator and rigidbody.
virtual void FixedUpdate ()
 On fixed update we move the character and update its animator.
virtual void Movement ()
 Acts on the rigidbody's velocity to move the character based on its current horizontal and vertical values.
virtual void Flip ()
 Flips the character and its dependencies horizontally.
virtual void UpdateAnimator ()
 Updates the animator's parameters.
virtual void OnEnable ()
 On Enable, we start listening to MMInventoryEvents.
virtual void OnDisable ()
 On Disable, we stop listening to MMInventoryEvents.

Protected Attributes

int _currentArmor =0
int _currentWeapon =0
float _horizontalMove = 0f
float _verticalMove = 0f
Vector2 _movement
Animator _animator
Rigidbody2D _rigidBody2D
bool _isFacingRight = true

Detailed Description

Demo character controller, very basic stuff.

Member Function Documentation

◆ FixedUpdate()

virtual void MoreMountains.InventoryEngine.InventoryDemoCharacter.FixedUpdate ( )
protectedvirtual

On fixed update we move the character and update its animator.

◆ Flip()

virtual void MoreMountains.InventoryEngine.InventoryDemoCharacter.Flip ( )
protectedvirtual

Flips the character and its dependencies horizontally.

◆ Movement()

virtual void MoreMountains.InventoryEngine.InventoryDemoCharacter.Movement ( )
protectedvirtual

Acts on the rigidbody's velocity to move the character based on its current horizontal and vertical values.

◆ OnDisable()

virtual void MoreMountains.InventoryEngine.InventoryDemoCharacter.OnDisable ( )
protectedvirtual

On Disable, we stop listening to MMInventoryEvents.

◆ OnEnable()

virtual void MoreMountains.InventoryEngine.InventoryDemoCharacter.OnEnable ( )
protectedvirtual

On Enable, we start listening to MMInventoryEvents.

◆ OnMMEvent()

virtual void MoreMountains.InventoryEngine.InventoryDemoCharacter.OnMMEvent ( MMInventoryEvent inventoryEvent)
virtual

Catches MMInventoryEvents and if it's an "inventory loaded" one, equips the first armor and weapon stored in the corresponding inventories.

Parameters
inventoryEventInventory event.

◆ SetArmor()

virtual void MoreMountains.InventoryEngine.InventoryDemoCharacter.SetArmor ( int index)
virtual

Sets the current armor.

Parameters
indexIndex.

◆ SetHorizontalMove()

virtual void MoreMountains.InventoryEngine.InventoryDemoCharacter.SetHorizontalMove ( float value)
virtual

Sets the horizontal move value.

Parameters
valueValue.

◆ SetMovement()

virtual void MoreMountains.InventoryEngine.InventoryDemoCharacter.SetMovement ( float movementX,
float movementY )
virtual

Updates the character's movement values for this frame.

Parameters
movementXMovement x.
movementYMovement y.

◆ SetVerticalMove()

virtual void MoreMountains.InventoryEngine.InventoryDemoCharacter.SetVerticalMove ( float value)
virtual

Sets the vertical move value.

Parameters
valueValue.

◆ SetWeapon()

virtual void MoreMountains.InventoryEngine.InventoryDemoCharacter.SetWeapon ( Sprite newSprite,
InventoryItem item )
virtual

Sets the current weapon sprite.

Parameters
newSpriteNew sprite.
itemItem.

◆ Start()

virtual void MoreMountains.InventoryEngine.InventoryDemoCharacter.Start ( )
protectedvirtual

On Start, we store the character's animator and rigidbody.

◆ UpdateAnimator()

virtual void MoreMountains.InventoryEngine.InventoryDemoCharacter.UpdateAnimator ( )
protectedvirtual

Updates the animator's parameters.

Member Data Documentation

◆ _animator

Animator MoreMountains.InventoryEngine.InventoryDemoCharacter._animator
protected

◆ _currentArmor

int MoreMountains.InventoryEngine.InventoryDemoCharacter._currentArmor =0
protected

◆ _currentWeapon

int MoreMountains.InventoryEngine.InventoryDemoCharacter._currentWeapon =0
protected

◆ _horizontalMove

float MoreMountains.InventoryEngine.InventoryDemoCharacter._horizontalMove = 0f
protected

◆ _isFacingRight

bool MoreMountains.InventoryEngine.InventoryDemoCharacter._isFacingRight = true
protected

◆ _movement

Vector2 MoreMountains.InventoryEngine.InventoryDemoCharacter._movement
protected

◆ _rigidBody2D

Rigidbody2D MoreMountains.InventoryEngine.InventoryDemoCharacter._rigidBody2D
protected

◆ _verticalMove

float MoreMountains.InventoryEngine.InventoryDemoCharacter._verticalMove = 0f
protected

◆ ArmorInventory

Inventory MoreMountains.InventoryEngine.InventoryDemoCharacter.ArmorInventory

the armor inventory

◆ CharacterSpeed

float MoreMountains.InventoryEngine.InventoryDemoCharacter.CharacterSpeed = 300f

the character speed

◆ PlayerID

string MoreMountains.InventoryEngine.InventoryDemoCharacter.PlayerID = "Player1"

◆ WeaponInventory

Inventory MoreMountains.InventoryEngine.InventoryDemoCharacter.WeaponInventory

the weapon inventory

◆ WeaponSprite

SpriteRenderer MoreMountains.InventoryEngine.InventoryDemoCharacter.WeaponSprite

the sprite used to show the current weapon


The documentation for this class was generated from the following file:
  • H:/Code/MoreMountains/topdownengine/Assets/TopDownEngine/ThirdParty/MoreMountains/InventoryEngine/Demos/PixelRogue/Scripts/InventoryDemoCharacter.cs