本文整理汇总了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();
}
示例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);
}
}
示例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);
}
}
示例4: GetCharacterMovement
void ARadeCharacter::DoubleJump_Implementation()
{
// Set player Velocity on server
GetCharacterMovement()->Velocity.Z += JumpJetPack.CurrentChargePercent*JumpJetPack.PushPower;
JumpJetPack.CurrentChargePercent = 0;
bCanFillJetPack = false;
}
示例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();
}
示例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;
}
}
示例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;
}
示例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);
}
}
}
}
示例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++)
}
示例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();
}
示例11: GetCharacterMovement
// Called when the game starts or when spawned
void ABaseCharacter::BeginPlay()
{
Super::BeginPlay();
OriginalWalkSpeed = GetCharacterMovement()->MaxWalkSpeed;
SetCameraView(bIsInFirstPersonView);
}
示例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;
}
示例13:
void ACloud10Character::Jump()
{
JumpKeyHoldTime = 0.0f;
if (GetCharacterMovement()->IsMovingOnGround())
bPressedJump = true;
else bPressedJump = false;
}
示例14: Tick
// Called every frame
void APlayerCharacter::Tick( float DeltaTime )
{
Super::Tick( DeltaTime );
if (_jumpCount > 0 && GetCharacterMovement()->IsMovingOnGround())
{
_jumpCount = 0;
}
}
示例15: GetCharacterMovement
bool ANimModCharacter::IsCrouched() const
{
UCharacterMovementComponent* MoveComp = GetCharacterMovement();
if (MoveComp)
return MoveComp->IsCrouching();
return bIsCrouched;
}