public void Execute(TriggerEvent triggerEvent)
        {
            if (cuterEntities.HasComponent(triggerEvent.Entities.EntityA))
            {
                if (cutableEntities.HasComponent(triggerEvent.Entities.EntityB) && !waitingToBeDestroyedEntities.HasComponent(triggerEvent.Entities.EntityB))
                {
                    Debug.Log("EntityA is Slicing EntityB");

                    PlayerComponentData player = cuterEntities[triggerEvent.Entities.EntityA];
                    player.m_score += 1;
                    cuterEntities[triggerEvent.Entities.EntityA] = player;

                    m_entityCommandBuffer.AddComponent(triggerEvent.Entities.EntityB, new DestroyComponent
                    {
                        useless = true
                    });
                }
            }

            if (cuterEntities.HasComponent(triggerEvent.Entities.EntityB))
            {
                if (cutableEntities.HasComponent(triggerEvent.Entities.EntityA) && !waitingToBeDestroyedEntities.HasComponent(triggerEvent.Entities.EntityA))
                {
                    Debug.Log("EntityB Player is Slicing EntityA");
                    PlayerComponentData player = cuterEntities[triggerEvent.Entities.EntityB];
                    player.m_score += 1;
                    cuterEntities[triggerEvent.Entities.EntityB] = player;

                    m_entityCommandBuffer.AddComponent(triggerEvent.Entities.EntityA, new DestroyComponent
                    {
                        useless = true
                    });
                }
            }
        }
Exemplo n.º 2
0
    public void Convert(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem)
    {
        var playerCD = new PlayerComponentData();

        playerCD.cam      = this.cam;
        playerCD.speed    = this.speed;
        playerCD.hashCode = GetHashCode();

        dstManager.AddSharedComponentData(entity, playerCD);
    }