Esempio n. 1
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));
        }
Esempio n. 2
0
        protected override void OnCreate()
        {
            base.OnCreate();
            var attributeModifierTag = new PermanentAttributeModifierTag();

            this.Queries[0] = GetEntityQuery(
                attributeModifierTag.AttributeOperatorQueryComponents <TAttributeTag, Components.Operators.Add>()
                );
            this.Queries[1] = GetEntityQuery(
                attributeModifierTag.AttributeOperatorQueryComponents <TAttributeTag, Components.Operators.Multiply>()
                );
            this.Queries[2] = GetEntityQuery(
                attributeModifierTag.AttributeOperatorQueryComponents <TAttributeTag, Components.Operators.Divide>()
                );

            this.actorsWithAttributesQuery = GetEntityQuery(
                ComponentType.ReadOnly <AbilitySystemActorTransformComponent>(),
                ComponentType.ReadWrite <TAttributeTag>()
                );
            m_EntityCommandBuffer = World.GetOrCreateSystem <BeginInitializationEntityCommandBufferSystem>();
            shouldRunQuery        = GetEntityQuery(ComponentType.ReadOnly <PermanentAttributeModifierTag>());
        }
Esempio n. 3
0
 public void CreateSourceAttributeModifiers(EntityManager dstManager, Entity actorEntity)
 {
     var entity = new PermanentAttributeModifierTag()
                  .CreateAttributeModifier <ManaAttributeComponent, Components.Operators.Add>(dstManager, actorEntity, -1);
 }