예제 #1
0
 public static void DestroyEntityIfEmpty(this PoolContext context,
                                         PoolEntity entity)
 {
     if (entity.GetComponentIndices().Length == 0)
     {
         context.DestroyEntity(entity);
     }
 }
 protected override void Execute(List<PoolEntity> entities)
 {
     foreach (var e in entities)
     {
         if (e.destructible.hp <= 0)
         {
             pool.DestroyEntity(e);
         }
     }
 }
예제 #3
0
    protected override void Execute(List <PoolEntity> entities)
    {
        int level = pool.level.level;

        // delete previous elements
        foreach (var entity in deleteOnExitGroup.GetEntities())
        {
            pool.DestroyEntity(entity);
        }

        SetupScene(level);
        pool.isNextTurn = true;
    }
예제 #4
0
    void OnAudioAdded(IGroup <PoolEntity> group, PoolEntity entity, int index,
                      IComponent component)
    {
        pool.DestroyEntity(entity);


        var originalPitch = efxSource.pitch;

        efxSource.pitch = Random.Range(lowPitchRange, highPitchRange);
        efxSource.Play();
        efxSource.pitch = originalPitch;
        return;
    }
예제 #5
0
    void OnAudioAdded(IGroup <PoolEntity> group, PoolEntity entity, int index,
                      IComponent component)
    {
        var audioComponent = (AudioComponent)component;
        var audioName      = audioComponent.clipNames.Random();
        var audioClip      = Resources.Load <AudioClip>("Audio/" + audioName);

        if (audioClip != null)
        {
            Play(audioClip, audioComponent.randomizePitch);
        }

        // only play once
        pool.DestroyEntity(entity);
    }
예제 #6
0
    protected override void Execute(List <PoolEntity> entities)
    {
        var position = pool.controllableEntity.position;
        ICollection <PoolEntity> posEntities;

        pool.IsGameBoardPositionOpen(position, out posEntities);

        PoolEntity food;

        if (posEntities != null &&
            posEntities.ContainsComponent(PoolComponentsLookup.Food, out food))
        {
            int points = food.food.points;

            pool.AddToFoodBag(points);
            pool.DestroyEntity(food);
        }
    }