Esempio n. 1
0
        public void AddItem(IWorldItem item, bool randomPosition = true)
        {
            _collisionHandler.AddItem(item);
            _items.Add(item);

            if (randomPosition)
            {
                item.SetPosition(GetRandomFreePosition());
            }

            item.SetParent(transform);
            item.OnDestroyed += (IWorldItem itemDestroyed) => {
                if (_items.Contains(itemDestroyed))
                {
                    _items.Remove(itemDestroyed);
                }
            };
        }