GAS概述

内容来自UE GAS官方文档。

犯了个错误,一开始就去看了GAS详细文档,了解任何一样东西,先理解整体总是最好的。

现在先从UE官方文档看一个大概。

Gameplay Ability: 可以是c++或者蓝图类,定义了Ability的结构以及replication和实例化行为。

Ability Tasks: 写在c++中,经常性在执行完后调用相关delegate,例如可能与cancel GA有关。

Gameplay Atttributes: 属性,如生命值

Gameplay Effects: 更像是各种buff和debuff

Ability System Component: Any Actor that interacts with the Gameplay Ability System must have an Ability System Component。This Component will activate Abilities, store Attributes, update Effects, and handle interactions between Actors

GameplayAbility(GA)

下面是几个在ASC中的函数

grantability

  • GiveAbility: Specifies the Ability to add with an FGameplayAbilitySpec, and returns an FGameplayAbilitySpecHandle.

  • GiveAbilityAndActivateOnce: Specifies the Ability to add with an FGameplayAbilitySpec, and returns an FGameplayAbilitySpecHandle. The Ability must be instanced and able to run on the server. After attempting to run the Ability on the server, a FGameplayAbilitySpecHandle will be returned. If the Ability did not meet the required criteria, or if it could not execute, the return value will be invalid and the Ability System Component will not be granted the Ability.

revoke abiliy, 通过FGameplayAbilitySpecHandle

  • ClearAbility: Removes the specified Ability from the Ability System Component.

  • SetRemoveAbilityOnEnd: Removes the specified Ability from the Ability System Component when that ability is finished executing. If the Ability is not executing, it will be removed immediately. If the Ability is executing, its input will be cleared immediately so that the player cannot reactivate or interact with it any further.

  • ClearAllAbilities: Removes all Abilities from the Ability System Component. This function is the only one that does not require an FGameplayAbilitySpecHandle.

基本使用

CanActivateAbility: 是否能使用,例如测试如果技能不能使用,设置icon为灰色。

CallActivateAbility:关于使用Ability,经常先CanActivateAbility之后用这个 

主要需要覆写的函数是ActivateAbility, 

CommitAbility:用来apply the cost of executing the ability. 例如扣蓝。

CancelAbility:provides a mechanism to cancel the Ability, although the Ability's CanBeCanceled function can reject the request。和CommitAbility不同,this function is available for callers outside of the

  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值