Example #1
0
        public IList <Item> PlaceDrop(Dungeon dungeon, Vec dropPosition)
        {
            IList <Item> items = new List <Item>();

            if (Drop != null)
            {
                foreach (Item item in Drop.Create(Depth))
                {
                    Vec position = dungeon.GetOpenItemPosition(dropPosition);
                    item.ForcePosition(position);
                    dungeon.Items.Add(item);

                    items.Add(item);
                }
            }

            return(items);
        }
        public static void BreakRock(Level level, Dot ww, int x, int y, Tile l)
        {
            AudioEmitterComponent.Dummy(level.Area, ww).Emit($"level_rock_{Rnd.Int(1, 3)}", 0.5f);

            if (l.IsRock())
            {
                Drop.Create(l == Tile.TintedRock ? "bk:tinted_rock" : "bk:rock", null, level.Area, ww);
            }

            for (var i = 0; i < 3; i++)
            {
                var part = new ParticleEntity(Particles.Dust());

                part.Position = ww;
                level.Area.Add(part);
            }

            Particles.BreakSprite(level.Area, (l == Tile.TintedRock ? level.Tileset.TintedRock : (l == Tile.MetalBlock ? level.Tileset.MetalBlock : level.Tileset.Rock))[Rnd.Int(4)], ww);

            level.Set(x, y, Tile.Ember);
            level.UpdateTile(x, y);
            level.ReCreateBodyChunk(x, y);
        }
Example #3
0
    public GameObject GetPooledDrop(string prefab, Vector3 pos, Effect e)
    {
        if (!pooledDrops.ContainsKey(prefab))
        {
            pooledDrops.Add(prefab, new List <GameObject>());
        }
        List <GameObject> pool = pooledDrops[prefab];

        foreach (GameObject pd in pool)
        {
            if (!pd.activeInHierarchy)
            {
                Drop drop = isDrop(pd);
                drop.setValues(pos);
                pd.SetActive(true);
                return(pd);
            }
        }

        GameObject obj = Drop.Create(prefab, pos, e).gameObject;

        pool.Add(obj);
        return(obj);
    }
 public void SpawnDrops()
 {
     Drop.Create(Drops, Entity);
 }