當前位置: 首頁>>代碼示例>>C++>>正文


C++ GetCharacterMovement函數代碼示例

本文整理匯總了C++中GetCharacterMovement函數的典型用法代碼示例。如果您正苦於以下問題:C++ GetCharacterMovement函數的具體用法?C++ GetCharacterMovement怎麽用?C++ GetCharacterMovement使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了GetCharacterMovement函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。

示例1: GetCharacterMovement

void ARoguelikeChar::ChangeStamina(float Amount)
{
	CurrentStamina += Amount;

	if (bIsOnCooldown)
	{
		if (CurrentStamina > CooldownResetLim)
		{
			bIsOnCooldown = false;
		}
	}

	if (CurrentStamina <= 0)
	{
		CurrentStamina = 0;

		bIsSprinting = false;
		PlayerAnimationInstance->bIsSprinting = bIsSprinting;
		StaminaRate = StaminaRate * (-0.5f);
		GetCharacterMovement()->MaxWalkSpeed = InitialMovementSpeed;

		bIsOnCooldown = true;

	}
	else if (CurrentStamina > MaxStamina)
	{
		CurrentStamina = MaxStamina;
	}

	PlayerController->UpdateUI();
}
開發者ID:DigitalDok,項目名稱:MyPortfolioSnippets,代碼行數:31,代碼來源:RoguelikeChar.cpp

示例2: MoveForward

void AFPSCharacter::MoveForward(float Value)
{
    if ( (Controller != NULL) && (Value != 0.0f) )
    {
	// find out which way is forward
	FRotator Rotation = Controller->GetControlRotation();
	// Limit pitch when walking or falling
	if (GetCharacterMovement()->IsMovingOnGround() || GetCharacterMovement()->IsFalling() )
	{
	    Rotation.Pitch = 0.0f;
	}
	// add movement in that direction
	const FVector Direction = FRotationMatrix(Rotation).GetScaledAxis(EAxis::X);
	AddMovementInput(Direction, Value);
    }
}
開發者ID:jhallard,項目名稱:FPSProject,代碼行數:16,代碼來源:FPSCharacter.cpp

示例3: GetCharacterMovement

void AMech_RPGCharacter::BeginPlay() {
	Super::BeginPlay();
	GetCharacterMovement()->SetAvoidanceEnabled(true);
	if (IsPendingKill()) {
		return;
	}

	if (!UseLoadout) {
		//CreatePresetRole(StartingRole());
	}
	else {
		SetupWithLoadout();
	}

	if (abilities.Num() > 0) {
		SetCurrentAbility(abilities[0]);
	}

	//SetUpGroup();
	SetUpWidgets();

	if (OnPostBeginPlay.IsBound()) {
		OnPostBeginPlay.Broadcast(this);
	}
}
開發者ID:belven,項目名稱:Mech_RPG,代碼行數:25,代碼來源:Mech_RPGCharacter.cpp

示例4: GetCharacterMovement

void ARadeCharacter::DoubleJump_Implementation()
{	
	// Set player Velocity on server
	GetCharacterMovement()->Velocity.Z += JumpJetPack.CurrentChargePercent*JumpJetPack.PushPower;
	JumpJetPack.CurrentChargePercent = 0;
	bCanFillJetPack = false;
}
開發者ID:dcyoung,項目名稱:Rade,代碼行數:7,代碼來源:RadeCharacter.cpp

示例5: ToggleLaserVisibility

void ARoguelikeChar::InitializeGameplayStats()
{
	BulletsLeft_A = (User_BulletsLeft_A > 0) ? MaxAmmoHolderSize : 0;
	BulletsLeft_B = (User_BulletsLeft_B > 0) ? MaxAmmoHolderSize : 0;
	BulletsLeft_C = (User_BulletsLeft_C > 0) ? MaxAmmoHolderSize : 0;

	BulletsLeft_A_Total = User_BulletsLeft_A;
	BulletsLeft_B_Total = User_BulletsLeft_B;
	BulletsLeft_C_Total = User_BulletsLeft_C;

	MaxStamina = 100.0f;
	CurrentStamina = MaxStamina;

	MaxHealth = 100.0f;
	CurrentHealth = MaxHealth;

	Kills = 0;

	Wave = 1;
	PlayerAnimationInstance->bCanShoot = true;

	DeathCamera->Deactivate();
	ToggleLaserVisibility(false);

	InitialMovementSpeed = GetCharacterMovement()->MaxWalkSpeed;
	bIsAiming = bIsSprinting = false;

	PlayerController->UpdateUI();

}
開發者ID:DigitalDok,項目名稱:MyPortfolioSnippets,代碼行數:30,代碼來源:RoguelikeChar.cpp

示例6: GetCharacterMovement

/**
*	Update the default max speed rate with new rate.
*
*	@param Speed to move
*	@return void
**/
void APlayerCharacter::SetSpeed(float speed)
{
	if(!SpeedBoostActive)
	{
	GetCharacterMovement()->MaxWalkSpeed = speed;
	}
}
開發者ID:jackdurnford,項目名稱:MidnightSnag,代碼行數:13,代碼來源:PlayerCharacter.cpp

示例7: GetCharacterMovement

FVector ACharacter::GetNavAgentLocation() const
{
	FVector AgentLocation = FNavigationSystem::InvalidLocation;

	if (GetCharacterMovement() != nullptr)
	{
		AgentLocation = GetCharacterMovement()->GetActorFeetLocation();
	}

	if (FNavigationSystem::IsValidLocation(AgentLocation) == false && CapsuleComponent != nullptr)
	{
		AgentLocation = GetActorLocation() - FVector(0, 0, CapsuleComponent->GetScaledCapsuleHalfHeight());
	}

	return AgentLocation;
}
開發者ID:amyvmiwei,項目名稱:UnrealEngine4,代碼行數:16,代碼來源:Character.cpp

示例8: GetCharacterMovement

void APaperCharacter::PostInitializeComponents()
{
	Super::PostInitializeComponents();

	if (!IsPendingKill())
	{
		if (Sprite)
		{
			// force animation tick after movement component updates
			if (Sprite->PrimaryComponentTick.bCanEverTick && GetCharacterMovement())
			{
				Sprite->PrimaryComponentTick.AddPrerequisite(GetCharacterMovement(), GetCharacterMovement()->PrimaryComponentTick);
			}
		}
	}
}
開發者ID:PickUpSU,項目名稱:UnrealEngine4,代碼行數:16,代碼來源:PaperCharacter.cpp

示例9: GetCapsuleComponent

ABatteryCollectorCharacter::ABatteryCollectorCharacter()
{
	// Set size for collision capsule
	GetCapsuleComponent()->InitCapsuleSize(42.f, 96.0f);

	// set our turn rates for input
	BaseTurnRate = 45.f;
	BaseLookUpRate = 45.f;

	// Don't rotate when the controller rotates. Let that just affect the camera.
	bUseControllerRotationPitch = false;
	bUseControllerRotationYaw = false;
	bUseControllerRotationRoll = false;

	// Configure character movement
	GetCharacterMovement()->bOrientRotationToMovement = true; // Character moves in the direction of input...	
	GetCharacterMovement()->RotationRate = FRotator(0.0f, 540.0f, 0.0f); // ...at this rotation rate
	GetCharacterMovement()->JumpZVelocity = 600.f;
	GetCharacterMovement()->AirControl = 0.2f;

	// Create a camera boom (pulls in towards the player if there is a collision)
	CameraBoom = CreateDefaultSubobject<USpringArmComponent>(TEXT("CameraBoom"));
	CameraBoom->AttachTo(RootComponent);
	CameraBoom->TargetArmLength = 300.0f; // The camera follows at this distance behind the character	
	CameraBoom->bUsePawnControlRotation = true; // Rotate the arm based on the controller

	// Create a follow camera
	FollowCamera = CreateDefaultSubobject<UCameraComponent>(TEXT("FollowCamera"));
	FollowCamera->AttachTo(CameraBoom, USpringArmComponent::SocketName); // Attach the camera to the end of the boom and let the boom adjust to match the controller orientation
	FollowCamera->bUsePawnControlRotation = false; // Camera does not rotate relative to arm

	// Collection Sphere
	CollectionSphere = CreateDefaultSubobject<USphereComponent>(TEXT("CollectionSphere"));
	CollectionSphere->AttachTo(RootComponent);
	CollectionSphere->SetSphereRadius(200);

	// Set Power Level
	InitialPower = 2000;
	CharacterPower = InitialPower;

	// Set speed
	SpeedFactor = 0.75f;
	BaseSpeed = 10;

	// Note: The skeletal mesh and anim blueprint references on the Mesh component (inherited from Character) 
	// are set in the derived blueprint asset named MyCharacter (to avoid direct content references in C++)
}
開發者ID:DrunkReaperMatt,項目名稱:BatteryCollector,代碼行數:47,代碼來源:BatteryCollectorCharacter.cpp

示例10: GetCharacterMovement

// Update power level of the character
void ABatteryCollectorCharacter::UpdatePower(float PowerChange)
{
	CharacterPower += PowerChange;
	// change speed based on power
	GetCharacterMovement()->MaxWalkSpeed = BaseSpeed + SpeedFactor * CharacterPower;
	// call visual effect
	PowerChangeEffect();
}
開發者ID:digitaldominus,項目名稱:BatteryCollector,代碼行數:9,代碼來源:BatteryCollectorCharacter.cpp

示例11: GetCharacterMovement

// Called when the game starts or when spawned
void ABaseCharacter::BeginPlay()
{
	Super::BeginPlay();
	
	OriginalWalkSpeed = GetCharacterMovement()->MaxWalkSpeed;

	SetCameraView(bIsInFirstPersonView);
}
開發者ID:TheComet93,項目名稱:iceweasel,代碼行數:9,代碼來源:BaseCharacter.cpp

示例12: FConstructorStatics

// Sets default values
ASoldierPawn::ASoldierPawn()
{
	struct FConstructorStatics
	{
		ConstructorHelpers::FObjectFinderOptional<UPaperFlipbook> RunAnimationAsset;
		ConstructorHelpers::FObjectFinderOptional<UPaperFlipbook> IdleAnimationAsset;

		FConstructorStatics()
			: RunAnimationAsset(TEXT("/Game/2dSideScroller/Animation/Soldier/Run.Run")),
			IdleAnimationAsset(TEXT("/Game/2dSideScroller/Animation/Soldier/Idle.Idle"))
		{
		}
	};
	static FConstructorStatics ConstructorStatics;

	RunAnimation = ConstructorStatics.RunAnimationAsset.Get();
	IdleAnimation = ConstructorStatics.IdleAnimationAsset.Get();

	GetSprite()->SetFlipbook(IdleAnimation);
	GetSprite()->SetRelativeScale3D(FVector(4.5, 1, 4.5));


	// Use only Yaw from the controller and ignore the rest of the rotation.
	bUseControllerRotationPitch = false;
	bUseControllerRotationYaw = true;
	bUseControllerRotationRoll = false;

	// Set the size of our collision capsule.
	GetCapsuleComponent()->SetCapsuleHalfHeight(90);
	GetCapsuleComponent()->SetCapsuleRadius(43);
	GetCapsuleComponent()->SetRelativeLocation(FVector(-25, 0, 0));

	// Set this character to call Tick() every frame.  You can turn this off to improve performance if you don't need it.
	// PrimaryActorTick.bCanEverTick = true;

	RootComponent = CreateDefaultSubobject<USceneComponent>(TEXT("Root Component"));

	// Configure character movement
	GetCharacterMovement()->GravityScale = 2.0f;
	GetCharacterMovement()->AirControl = 0.80f;
	GetCharacterMovement()->JumpZVelocity = 1000.f;
	GetCharacterMovement()->GroundFriction = 3.0f;
	GetCharacterMovement()->MaxWalkSpeed = 600.0f;
	GetCharacterMovement()->MaxFlySpeed = 600.0f;

	// Lock character motion onto the XZ plane, so the character can't move in or out of the screen
	GetCharacterMovement()->bConstrainToPlane = true;
	GetCharacterMovement()->SetPlaneConstraintNormal(FVector(0, -1, 0));

	GetCharacterMovement()->bUseFlatBaseForFloorChecks = true;
}
開發者ID:NightWolf007,項目名稱:ContraProject,代碼行數:52,代碼來源:SoldierPawn.cpp

示例13:

void ACloud10Character::Jump()
{

	JumpKeyHoldTime = 0.0f;
	if (GetCharacterMovement()->IsMovingOnGround())
		bPressedJump = true;
	else bPressedJump = false;
}
開發者ID:KaroA,項目名稱:Cloud-10,代碼行數:8,代碼來源:Cloud10Character.cpp

示例14: Tick

// Called every frame
void APlayerCharacter::Tick( float DeltaTime )
{
	Super::Tick( DeltaTime );
	if (_jumpCount > 0 && GetCharacterMovement()->IsMovingOnGround())
	{
		_jumpCount = 0;
	}
}
開發者ID:Zyrst,項目名稱:Run,代碼行數:9,代碼來源:PlayerCharacter.cpp

示例15: GetCharacterMovement

bool ANimModCharacter::IsCrouched() const
{
	UCharacterMovementComponent* MoveComp = GetCharacterMovement();
	if (MoveComp)
		return MoveComp->IsCrouching();

	return bIsCrouched;
}
開發者ID:Nimgoble,項目名稱:NimMod,代碼行數:8,代碼來源:NimModCharacter.cpp


注:本文中的GetCharacterMovement函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。