CPP: Fetching From and Casting to Master Character Blueprint

EASIER VERSION:

  1. How I can make the Actor Component of my Custom Locomotion System, inside Character_Master fetch the AnimInstance from child of Character_Master (Character_Player)?
  2. How I can trigger functions inside my Custom Locomotion System from from child of Character_Master (Character_Player)?

I’ve decided to make Master Character class that is a Parent of Player and Enemy classes.

Thing is I made my own Locomotion System (ACO - Actor Component) inside the Master Character Class and I’m trying to make it:

  1. Fetch the AnimInstance assigned to Player/Enemy (Child), for ACO of my Custom Locomotion System, parented to Master.

I care about optimalization, even if it’ll give slightest results.

For AnimInstance: I wanted to decrease load on fetching the Enum values, from my Locomotion System assigned to Master.

Locomotion System (Parented to Master - Code Snippet):

			ELS_MSB.MoveState_IsAirborne = CO_CndPlayerCharacterMove->IsFalling();

			if (ELS_MSB.MoveState_IsAirborne && !MoveStateLock_IsAirborne)
			{

				MoveStateLock_IsAirborne = true;
				ELS_Mvnt.State_Current = ECndMoveSys_State::MSTE_InAir;

				ELS_UTE_MvntAction = true;


			}
			else if (!ELS_MSB.MoveState_IsAirborne && MoveStateLock_IsAirborne)
			{

				MoveStateLock_IsAirborne = false;
				ELS_Mvnt.State_Current = ECndMoveSys_State::MSTE_Default;

			}
			// Send Updated Values to Child of Character_Master -> Character_Player Animation Instance
			BPF_UpdateOnce_SendToAnimInstance();
  1. Triggering Movement (Jump) from Character_Player to ACO_CLS inside Master.
void UCndPlayer_CustomLocomotionSystem::BPF_MACT_Jump()
{

	Input_Jump = !Input_Jump;

	if (Input_Jump) // Is Jump Pressed/Held?
	{

		switch (ELS_Mvnt.State_Current)
		{

		case ECndMoveSys_State::MSTE_Default: // Player Is On Ground

		switch (ELS_Mvnt.Stance_Current)
			{
	
			case ECndMoveSys_StanceType::STA_Standing: // Is Player Standing?

				BPF_MACT_PerformTACT_Jump();

			break;

			case ECndMoveSys_StanceType::STA_Laying: // Is Player Laying?

				BPF_MACT_PerformStandup();

				break;

			}

			break;

		}

	}

	else // Is Jump Released?
	{

		BPF_MACT_JumpReleased();

	}

}

Any help how I can do both?

Bump.

How I can make my locomotion system, inside Master Character fetch the AnimInstance of the Child (Player/Enemy)?