public Entity Instantiate(int jobIndex, EntityCommandBuffer.Concurrent Ecb, Entity actorEntity, float duration)
        {
            var entity = Ecb.CreateEntity(jobIndex);

            Ecb.AddComponent <GameplayEffectDurationComponent>(jobIndex, entity, GameplayEffectDurationComponent.Initialise(DURATION, 0f));
            Ecb.AddComponent <GameplayEffectTargetComponent>(jobIndex, entity, actorEntity);
            Ecb.AddComponent(jobIndex, entity, this.GetType());
            new PermanentAttributeModifierTag()
            {
            }.CreateAttributeModifier <HealthAttributeComponent, Add>(jobIndex, Ecb, actorEntity, Damage);
            return(entity);
        }
Exemplo n.º 2
0
        public Entity Instantiate(EntityManager dstManager, Entity actorEntity, float duration)
        {
            var archetype = dstManager.CreateArchetype(
                typeof(GameplayEffectDurationComponent),
                typeof(GameplayEffectTargetComponent),
                typeof(GameplayEffectBuffIndex),
                this.GetType());

            var entity = dstManager.CreateEntity(archetype);

            dstManager.SetComponentData <GameplayEffectTargetComponent>(entity, actorEntity);
            dstManager.SetComponentData <GameplayEffectBuffIndex>(entity, BuffIndex);
            dstManager.SetComponentData <GameplayEffectDurationComponent>(entity, GameplayEffectDurationComponent.Initialise(duration, UnityEngine.Time.time));
            return(entity);
        }
Exemplo n.º 3
0
        public Entity Instantiate(EntityManager dstManager, Entity actorEntity, float duration)
        {
            var archetype = dstManager.CreateArchetype(
                typeof(GameplayEffectDurationComponent),
                typeof(GameplayEffectTargetComponent),
                this.GetType());

            var entity = dstManager.CreateEntity(archetype);

            dstManager.SetComponentData <GameplayEffectTargetComponent>(entity, actorEntity);
            dstManager.SetComponentData <GameplayEffectDurationComponent>(entity, GameplayEffectDurationComponent.Initialise(DURATION, UnityEngine.Time.time));
            new PermanentAttributeModifierTag()
            {
            }.CreateAttributeModifier <HealthAttributeComponent, Add>(dstManager, actorEntity, Damage);
            return(entity);
        }
    /// <summary>
    /// For testing cooldowns
    /// </summary>
    /// <param name="dstManager"></param>
    /// <param name="abilitySystemEntity"></param>
    private void TestAbilitySystemCooldown(EntityManager dstManager, Entity abilitySystemEntity)
    {
        var cooldownArchetype = dstManager.CreateArchetype(
            typeof(GameplayEffectDurationComponent),
            typeof(GameplayEffectTargetComponent),
            typeof(GlobalCooldownGameplayEffectComponent));

        var cooldownEntity = dstManager.CreateEntity(cooldownArchetype);

        dstManager.SetComponentData <GameplayEffectTargetComponent>(cooldownEntity, abilitySystemEntity);
        dstManager.SetComponentData <GameplayEffectDurationComponent>(cooldownEntity, GameplayEffectDurationComponent.Initialise(10, 1));

        var cooldownEntity2 = dstManager.CreateEntity(cooldownArchetype);

        dstManager.SetComponentData <GameplayEffectTargetComponent>(cooldownEntity2, abilitySystemEntity);
        dstManager.SetComponentData <GameplayEffectDurationComponent>(cooldownEntity2, GameplayEffectDurationComponent.Initialise(5, 1));
    }
 public void Execute(Entity entity, int index, ref T abilityDurationComponent)
 {
     GameplayEffectDurations.Add(entity, GameplayEffectDurationComponent.Initialise(0, 0));
 }