六一的部落格


关关难过关关过,前路漫漫亦灿灿。




说明

添加标志位, 播放装备武器动画时置为true, 播放结束置为false


概览

  • 装备武器动画播放结束之前, 不允许切换武器
  • 装备武器动画播放结束之前, 不允许射击

装备武器标志位


定义

private

ShootThemUp: Components/STUWeaponComponent.h

1bool EquipAnimInProgress = false;

设置

ShootThemUp: Components/STUWeaponComponent.cpp

1//EquipWeapon
2EquipAnimInProgress = true;
3
4// OnEquipFinished
5EquipAnimInProgress = false;

添加接口: 允许更换武器


定义

  • ShootThemUp: Components/STUWeaponComponent.h
    1bool CanEquip() const;
  • ShootThemUp: Components/STUWeaponComponent.cpp
    1bool USTUWeaponComponent::CanFire() const { return (CurrentWeapon && !EquipAnimInProgress); }

调用

ShootThemUp: Components/STUWeaponComponent.cpp

1// NextWeapon
2if (!CanEquip()) return;

添加接口: 允许射击


定义

  • ShootThemUp: Components/STUWeaponComponent.h

    private
    1bool CanFire() const;
  • ShootThemUp: Components/STUWeaponComponent.cpp
    1bool USTUWeaponComponent::CanEquip() const { return !EquipAnimInProgress; }

调用

ShootThemUp: Components/STUWeaponComponent.cpp

1// FireStart
2if (!CanFire()) return;

装备武器标志位



说明

添加标志位, 播放装备武器动画时置为true, 播放结束置为false


概览

  • 装备武器动画播放结束之前, 不允许切换武器
  • 装备武器动画播放结束之前, 不允许射击

装备武器标志位


定义

private

ShootThemUp: Components/STUWeaponComponent.h

1bool EquipAnimInProgress = false;

设置

ShootThemUp: Components/STUWeaponComponent.cpp

1//EquipWeapon
2EquipAnimInProgress = true;
3
4// OnEquipFinished
5EquipAnimInProgress = false;

添加接口: 允许更换武器


定义

  • ShootThemUp: Components/STUWeaponComponent.h
    1bool CanEquip() const;
  • ShootThemUp: Components/STUWeaponComponent.cpp
    1bool USTUWeaponComponent::CanFire() const { return (CurrentWeapon && !EquipAnimInProgress); }

调用

ShootThemUp: Components/STUWeaponComponent.cpp

1// NextWeapon
2if (!CanEquip()) return;

添加接口: 允许射击


定义

  • ShootThemUp: Components/STUWeaponComponent.h

    private
    1bool CanFire() const;
  • ShootThemUp: Components/STUWeaponComponent.cpp
    1bool USTUWeaponComponent::CanEquip() const { return !EquipAnimInProgress; }

调用

ShootThemUp: Components/STUWeaponComponent.cpp

1// FireStart
2if (!CanFire()) return;