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); }
  • 相关阅读:
    AngularJs学习笔记(一)----------关于数据绑定
    水平垂直居中常见方式总结
    左边固定,右边自适应常见方式总结
    关于JavaScript的设计模式--笔记(1)
    SQL 分组后获取其中一个字段最大值的整条记录
    .NET交流 259868462
    C#可以自动在后台为属性创建字段
    委托的一个实例
    encodeURIComponent()对js参数进行编码,防止错误值
    相同的sql 分页查询结果
  • 原文地址:https://www.cnblogs.com/tilyougogannbare666/p/14034846.html
Copyright © 2011-2022 走看看