zoukankan      html  css  js  c++  java
  • UE4C++5加速跑/二倍镜

    //按键绑定
        PlayerInputComponent->BindAction("Sprint", IE_Pressed, this, &ALeamCppCharacter::SprintBegin);
        PlayerInputComponent->BindAction("Sprint", IE_Released, this, &ALeamCppCharacter::SprintStop);
    //头文件
    #include "GameFramework/CharacterMovementComponent.h"
    //对应函数,h里声明完的实现
    void ALeamCppCharacter::SprintBegin()
    {
        GetCharacterMovement()->MaxWalkSpeed = 2200;
    }
    
    void ALeamCppCharacter::SprintStop()
    {
        GetCharacterMovement()->MaxWalkSpeed = 600;
    }
    //二倍镜
    ALeamCppCharacter::ALeamCppCharacter() { PrimaryActorTick.bCanEverTick
    = true;//Tick是否被启用 } void ALeamCppCharacter::BeginPlay() {//时间轴 FloatCurve = NewObject<UCurveFloat>(); FloatCurve->FloatCurve.AddKey(0, 90); FloatCurve->FloatCurve.AddKey(0.3, 45); FOnTimelineFloatStatic OnTimeCallback; OnTimeCallback.BindUFunction(this, TEXT("DoZoom")); ZoomTimeline.AddInterpFloat(FloatCurve, OnTimeCallback); } void ALeamCppCharacter::SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) { PlayerInputComponent->BindAction("Zoom", IE_Pressed, this, &ALeamCppCharacter::ZoomBegin); PlayerInputComponent->BindAction("Zoom", IE_Released, this, &ALeamCppCharacter::ZoomStop); } void ALeamCppCharacter::ZoomBegin() { //FirstPersonCameraComponent->FieldOfView = 45; ZoomTimeline.Play(); } void ALeamCppCharacter::ZoomStop() { //FirstPersonCameraComponent->FieldOfView = 90; ZoomTimeline.Reverse(); } void ALeamCppCharacter::DoZoom(float FieldOfView) { FirstPersonCameraComponent->SetFieldOfView(FieldOfView); } void ALeamCppCharacter::Tick(float DeltaSeconds) { Super::Tick(DeltaSeconds); ZoomTimeline.TickTimeline(DeltaSeconds); }
  • 相关阅读:
    转载.net泛型理解说明
    转载Repository 和Unit of work的使用说明
    libtool的工作原理
    带有通配符的字符串匹配算法-C/C++
    linux core文件机制
    grep多条件和sed合并两行
    BZOJ 3232 圈地游戏 (分数规划 + SPFA找负/正环)
    CSP2019 D1T3 树上的数 (贪心+并查集)
    CSP-S 2019 第二轮 退役记
    object-c中的int NSInteger NSUInteger NSNumber辨析
  • 原文地址:https://www.cnblogs.com/tilyougogannbare666/p/14034846.html
Copyright © 2011-2022 走看看