Пример #1
0
    private GemCell ConvertToGemCell(SpawnItem spawn)
    {
        int     gem        = GemConverter.GetGemInt(spawn.GemName);
        GemCell newGemCell = GemCellPool.Instance.GetOneGemCell(gem);

        newGemCell.InitGem();
        var thisGem = newGemCell.Gem;

        if (thisGem.AllowBG)
        {
            int bg = GemBGConverter.GetGemInt(spawn.BgName);
            newGemCell.InitBgGem(bg);
        }
        if (thisGem.AllowFG)
        {
            int fg = GemFGConverter.GetGemInt(spawn.FgName);
            newGemCell.InitFgGem(fg);
        }
        return(newGemCell);
    }
Пример #2
0
 public void RemoveOneGem(Gem gem)
 {
     gem.OnDeActivate();
     if (usePool == true)
     {
         var id       = GemConverter.GetGemInt(gem.Id);
         var poolItem = GemPoolItems.Find(pool => pool.GemId == id);
         if (poolItem == null)
         {
             poolItem = new GemPoolItem {
                 GemId = id, Gems = new List <GameObject>()
             };
             GemPoolItems.Add(poolItem);
         }
         gem.gameObject.transform.parent        = transform;
         gem.gameObject.transform.localPosition = offPos;                    // Vector3.zero;
         gem.gameObject.SetActive(false);
         poolItem.Gems.Add(gem.gameObject);
     }
     else
     {
         Destroy(gem.gameObject);
     }
 }
Пример #3
0
 // Use this for initialization
 public void Init()
 {
     Type = GemConverter.GetGemInt(Id);
 }