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); }
  • 相关阅读:
    面向对象静态语言的模型
    语言的静态分析技术
    面向对象的核心元素与机制
    Lua 笔记
    Linux配置系统
    Linux文件类型
    Wijmo 日历插件
    窗外大雨,心里小雨
    一次胆战心惊的服务器经历
    一次胆战心惊的服务器经历
  • 原文地址:https://www.cnblogs.com/tilyougogannbare666/p/14034846.html
Copyright © 2011-2022 走看看