Пример #1
0
        private async void SeekTargetAndDestroy(IGameplayAbilitySystem AbilitySystem, GameplayEventData gameplayEventData, GameObject projectile)
        {
            await projectile.GetComponent <Projectile>().SeekTarget(gameplayEventData.Target.TargettingLocation.gameObject, gameplayEventData.Target.gameObject);

            _ = AbilitySystem.ApplyGameEffectToTarget(TargetGameplayEffect, gameplayEventData.Target);
            DestroyImmediate(projectile);
        }
Пример #2
0
        public override async void ActivateAbility(IGameplayAbilitySystem AbilitySystem, IGameplayAbility Ability)
        {
            var abilitySystemActor            = AbilitySystem.GetActor();
            var animationEventSystemComponent = abilitySystemActor.GetComponent <AnimationEventSystem>();
            var animatorComponent             = abilitySystemActor.GetComponent <Animator>();

            // Make sure we have enough resources.  End ability if we don't

            (_, var gameplayEventData) = await AbilitySystem.OnGameplayEvent.WaitForEvent((gameplayTag, eventData) => gameplayTag == WaitForEventTag);

            animatorComponent.SetTrigger(AnimationTriggerName);
            List <GameObject> objectsSpawned = new List <GameObject>();

            // projectile.transform.position = abilitySystemActor.transform.position + abilitySystemActor.transform.forward * 1.2f + new Vector3(0, 1.5f, 0);
            await animationEventSystemComponent.CustomAnimationEvent.WaitForEvent((x) => x == FireProjectile);

            AbilitySystem.ApplyGameEffectToTarget(TargetGameplayEffect, gameplayEventData.Target);

            var beh = animatorComponent.GetBehaviour <AnimationBehaviourEventSystem>();
            await beh.StateEnter.WaitForEvent((animator, stateInfo, layerIndex) => stateInfo.fullPathHash == Animator.StringToHash(CompletionAnimatorStateFullHash));

            // Commit ability cost
            // TODO: ApplyCost();

            // Wait for some specific gameplay event
            // Not applicable for base activate

            // Commit ability cooldown
            //TODO: ApplyCooldown();

            // Apply game effect(s)

            // End Ability
            Ability.EndAbility(AbilitySystem);
        }
 /// <summary>
 /// Applies cooldown.  Cooldown is applied even if the  ability is already
 /// on cooldown
 /// </summary>
 protected void ApplyCooldown(IGameplayAbilitySystem abilitySystem)
 {
     foreach (var cooldownEffect in this.CooldownsToApply)
     {
         abilitySystem.ApplyGameEffectToTarget(cooldownEffect, abilitySystem);
     }
 }
Пример #4
0
        public override async void ActivateAbility(IGameplayAbilitySystem AbilitySystem, IGameplayAbility Ability)
        {
            var abilitySystemActor            = AbilitySystem.GetActor();
            var animationEventSystemComponent = abilitySystemActor.GetComponent <AnimationEventSystem>();
            var animatorComponent             = abilitySystemActor.GetComponent <Animator>();

            // Make sure we have enough resources.  End ability if we don't

            (_, var gameplayEventData) = await AbilitySystem.OnGameplayEvent.WaitForEvent((gameplayTag, eventData) => gameplayTag == WaitForEventTag);

            animatorComponent.SetTrigger(AnimationTriggerName);
            animatorComponent.SetTrigger(AnimationCompleteTriggerName);

            if (ExecuteEffectEvent != null)
            {
                await animationEventSystemComponent.CustomAnimationEvent.WaitForEvent((x) => x == ExecuteEffectEvent);
            }
            _ = AbilitySystem.ApplyGameEffectToTarget(TargetGameplayEffect, gameplayEventData.Target);


            var beh = animatorComponent.GetBehaviour <AnimationBehaviourEventSystem>();
            await beh.StateEnter.WaitForEvent((animator, stateInfo, layerIndex) => stateInfo.fullPathHash == Animator.StringToHash(CompletionAnimatorStateFullHash));

            // End Ability
            Ability.EndAbility(AbilitySystem);
        }