Ejemplo n.º 1
0
 public abstract void ActivateAbility(IGameplayAbilitySystem AbilitySystem, IGameplayAbility Ability);
        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);

            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);
        }
Ejemplo n.º 3
0
 public abstract List <IGameplayAbilitySystem> InitiateTargetting(IGameplayAbilitySystem AbilitySystem, IGameplayAbility Ability);
Ejemplo n.º 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);
            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);
        }
Ejemplo n.º 5
0
 public override List <IGameplayAbilitySystem> InitiateTargetting(IGameplayAbilitySystem AbilitySystem, IGameplayAbility Ability)
 {
     return(new List <IGameplayAbilitySystem>());
 }
        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>();

            GameObject instantiatedProjectile = null;

            if (Projectile != null)
            {
                instantiatedProjectile = Instantiate(Projectile);
                instantiatedProjectile.transform.position = abilitySystemActor.transform.position + this.ProjectilePositionOffset + abilitySystemActor.transform.forward * 1.2f;
            }

            await animationEventSystemComponent.CustomAnimationEvent.WaitForEvent((x) => x == FireProjectile);



            // Animation complete.  Spawn and send projectile at target
            if (instantiatedProjectile != null)
            {
                SeekTargetAndDestroy(AbilitySystem, gameplayEventData, instantiatedProjectile);
            }


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

            Ability.EndAbility(AbilitySystem);
        }