public void AddBlocks(BlockTypes type, int count) { UIBlock b = Blocks.FirstOrDefault(u => u.BlockType == type); //does a block of this type already exist in the list if (b != null) { b.Count += count; } else { //if not, create a new block and initialize it GameObject o = Instantiate(uiBlockPrefab, this.transform); UIBlock u = o.GetComponent <UIBlock>(); UIBlockPositions p; switch (Blocks.Count) { case 0: p = UIBlockPositions.Bottom; break; case 1: p = UIBlockPositions.Left; break; case 2: p = UIBlockPositions.Right; break; default: case 3: p = UIBlockPositions.Top; break; } u.Init(type, p, count); Blocks.Add(u); } }
public void LoadContent(IResourceProvider _resourceProvider) { TileHelper.Init(_resourceProvider, m_gameProvider.DrawHelper); UIBlock.Init(m_gameProvider.DrawHelper); }