private void ActivateAbility(AbilitySystemComponent Source, AbilitySystemComponent Target, Entity AbilityEntity, HealAbilityComponent Ability)
        {
            var abilitySystemActor = Source.GetActor();


            //(_, var gameplayEventData) = await AbilitySystem.OnGameplayEvent.WaitForEvent((gameplayTag, eventData) => gameplayTag == WaitForEventTag);
            var gameplayEventData = new GameplayAbilitySystem.Events.GameplayEventData()
            {
                Instigator = Source,
                Target     = Target
            };

            GameObject instantiatedProjectile = null;

            instantiatedProjectile = Object.Instantiate(Prefab);
            instantiatedProjectile.transform.position = abilitySystemActor.transform.position + new Vector3(0, 1.5f, 0) + abilitySystemActor.transform.forward * 1.2f;
            var attributesComponent = GetComponentDataFromEntity <AttributesComponent>(false);

            Ability.ApplyGameplayEffects(World.Active.EntityManager, Source.entity, Target.entity, attributesComponent[Target.entity], Time.time);

            // Animation complete.  Spawn and send projectile at target
            // if (instantiatedProjectile != null) {
            //     SeekTargetAndDestroy(Source, Target, instantiatedProjectile, ability, AbilityEntity);
            // }
        }
        public override async void ActivateAbility(AbilitySystemComponent AbilitySystem, GameplayAbility 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);
        }
Esempio n. 3
0
        public override async void ActivateAbility(AbilitySystemComponent Source, AbilitySystemComponent Target, IAbilityBehaviour Ability)
        {
            var abilitySystemActor            = Source.GetActor();
            var animationEventSystemComponent = abilitySystemActor.GetComponent <AnimationEventSystem>();
            var animatorComponent             = abilitySystemActor.GetComponent <Animator>();

            // Ability.State = AbilityState.Activated;

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

            animatorComponent.SetTrigger(AnimationTriggerName);
            //(_, var gameplayEventData) = await AbilitySystem.OnGameplayEvent.WaitForEvent((gameplayTag, eventData) => gameplayTag == WaitForEventTag);
            var gameplayEventData = new GameplayEventData()
            {
                Instigator = Source,
                Target     = Target
            };

            List <GameObject> objectsSpawned = new List <GameObject>();

            GameObject instantiatedProjectile = null;

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

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

            animatorComponent.SetTrigger(ProjectileFireTriggerName);

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

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


            var beh = animatorComponent.GetBehaviour <AnimationBehaviourEventSystem>();
            await beh.StateEnter.WaitForEvent((animator, stateInfo, layerIndex) => stateInfo.fullPathHash == Animator.StringToHash(CompletionAnimatorStateFullHash));
        }
Esempio n. 4
0
        private void ActivateAbility(AbilitySystemComponent Source, AbilitySystemComponent Target, Entity AbilityEntity, FireAbilityComponent ability)
        {
            var abilitySystemActor = Source.GetActor();


            //(_, var gameplayEventData) = await AbilitySystem.OnGameplayEvent.WaitForEvent((gameplayTag, eventData) => gameplayTag == WaitForEventTag);
            var gameplayEventData = new GameplayAbilitySystem.Events.GameplayEventData()
            {
                Instigator = Source,
                Target     = Target
            };

            GameObject instantiatedProjectile = null;

            instantiatedProjectile = Object.Instantiate(Prefab);
            instantiatedProjectile.transform.position = abilitySystemActor.transform.position + new Vector3(0, 1.5f, 0) + abilitySystemActor.transform.forward * 1.2f;

            // Animation complete.  Spawn and send projectile at target
            if (instantiatedProjectile != null)
            {
                SeekTargetAndDestroy(Source, Target, instantiatedProjectile, ability, AbilityEntity);
            }
        }