コード例 #1
0
 private void Start()
 {
     for (int i = 1; i < this.transform.childCount; ++i)
     {
         IngredientUI ui  = this.transform.GetChild(i).gameObject.GetComponent <IngredientUI>();
         Ingredient   ing = this.grid.transform.GetChild(i + 5).gameObject.GetComponent <IngredientUI>().data;
         ui.ClearAndInstantiateCell(ing);
     }
 }
コード例 #2
0
    public static IngredientUI AddIngredient(Ingredient data)
    {
        // create new ingredientui and add it to the gridview
        IngredientUI cell = gridParent.GetChild(ingredientCount++).GetComponent <IngredientUI>();

        cell.ClearAndInstantiateCell(data);
        if (ingredientCount == 12)
        {
            // we've got a full grid. It's time to decide.
            gameplay.OnFinalCombination();
        }
        return(cell);
    }
コード例 #3
0
 // try and add an ingredient
 public bool AddIngredient(Ingredient item)
 {
     if (item1.data == null)
     {
         item1.data = item;
         item1.ClearAndInstantiateCell(item);
     }
     else if (item2.data == null)
     {
         item2.data = item;
         item2.ClearAndInstantiateCell(item2.data);
     }
     else
     {
         // play a bad sound
         return(false);
     }
     return(true);
 }