예제 #1
0
        public void CreateCooldownEntities(EntityManager dstManager, Entity actorEntity)
        {
            var tickEntity = new PeriodicTickActionComponent <PeriodicTickDelegate>()
                             .SetTickFunction(
                ((index, Ecb, entity, parentGameplayEffectEntity) => {
                new PermanentAttributeModifierTag()
                {
                }.CreateAttributeModifier <ManaAttributeComponent, Components.Operators.Add>(index, Ecb, entity, 0.1f);
            })
                )
                             .CreateEntity(dstManager);

            dstManager.SetComponentData <PeriodicTickComponent>(tickEntity, new PeriodicTickComponent()
            {
                TickPeriod       = 0.2f,
                TickDurationLeft = 1
            });
            dstManager.SetComponentData <PeriodicTickTargetComponent>(tickEntity, actorEntity);

            Entity cooldownEntity1 = new GlobalCooldownGameplayEffectComponent().Instantiate(dstManager, actorEntity, 1f);

            dstManager.SetComponentData <ParentGameplayEffectEntity>(tickEntity, new ParentGameplayEffectEntity(cooldownEntity1));

            new TemporaryAttributeModifierTag()
            {
                ParentGameplayEffectEntity = cooldownEntity1
            }.CreateAttributeModifier <ManaAttributeComponent, Components.Operators.Add>(dstManager, actorEntity, -5);
        }
예제 #2
0
        public void CreateTargetAttributeModifiers(EntityManager dstManager, Entity actorEntity)
        {
            var attributeEntity = new PermanentAttributeModifierTag()
                                  .CreateAttributeModifier <HealthAttributeComponent, Components.Operators.Add>(dstManager, actorEntity, -5f);
            // Create a "poison" effect
            Entity poisonEffectEntity = new PoisonGameplayEffectComponent().Instantiate(dstManager, actorEntity, 25f);

            var tickEntity = new PeriodicTickActionComponent <PeriodicTickDelegate>()
                             .SetTickFunction(
                ((index, Ecb, entity, parentGameplayEffectEntity) => {
                new PoisonTickGameplayEffectComponent()
                {
                    Damage = -1f
                }.Instantiate(index, Ecb, entity, -1f);
            })
                )
                             .CreateEntity(dstManager);

            dstManager.SetComponentData <PeriodicTickComponent>(tickEntity, new PeriodicTickComponent()
            {
                TickPeriod       = 0.9f,
                TickDurationLeft = 1
            });
            dstManager.SetComponentData <PeriodicTickTargetComponent>(tickEntity, actorEntity);
            dstManager.SetComponentData <ParentGameplayEffectEntity>(tickEntity, new ParentGameplayEffectEntity(poisonEffectEntity));
        }
예제 #3
0
 public void Execute(Entity entity, int index, ref ParentGameplayEffectEntity parentGameplayEffectEntity, ref PeriodicTickTargetComponent target, ref PeriodicTickComponent tick, ref PeriodicTickActionComponent <PeriodicTickDelegate> action)
 {
     if (tick.TickDurationLeft > 0)
     {
         return;
     }
     action.Tick.Invoke(index, Ecb, target, parentGameplayEffectEntity);
 }