Exemple #1
0
 public void Reset()
 {
     // TODO unsubscribe from events
     // return to pool
     if (ingredientVisual != null)
     {
         MainLogic.GetMainLogic().GetEntityManager().ReturnEntity(ingredientVisual);
         ingredientVisual = null;
     }
 }
Exemple #2
0
    static bool CheckSliceCollision(IngredientVisual ivis, Slice slc)
    {
        var objects = ivis.GetTouchingObjects();

        for (int i = 0; i < objects.Count; i++)
        {
            if (objects[i] == slc.gameObject)
            {
                return(true);
            }
        }
        return(false);
    }
Exemple #3
0
    // can be dragged from pizza to garbage

    public void Setup(Game.Models.IngredientMeta imeta)
    {
        ingredientMeta = imeta;

        GameObject gobject = MainLogic.GetMainLogic().GetEntityManager().GetEntity(ingredientMeta.assetName);

        gobject.SetActive(true);

        ingredientVisual = gobject.GetComponent <IngredientVisual>();

        //TODO subscribe to events

        ingredientVisual.AddMouseDownListener(MouseDown);
        ingredientVisual.AddMouseUpListener(MouseUp);
    }
Exemple #4
0
    Ingredient GetGarbage(IngredientVisual iv)
    {
        IngredientVisual lcVis;

        for (int i = 0; i < garbage.Count; i++)
        {
            lcVis = garbage[i].GetVisual();

            if (iv == lcVis)
            {
                return(garbage[i]);
            }
        }
        return(null);
    }
Exemple #5
0
    Ingredient GetIngredient(IngredientVisual iv)
    {
        IngredientVisual lcVis;

        for (int i = 0; i < ingredients.Count; i++)
        {
            lcVis = ingredients[i].GetVisual();

            if (iv == lcVis)
            {
                return(ingredients[i]);
            }
        }
        return(null);
    }
Exemple #6
0
    void OnGarbage(IngredientVisual trash)
    {
        Ingredient ing = null;

        ing = GetIngredient(trash);
        if (ing == null)
        {
            ing = GetGarbage(trash);
        }

        if (ing != null)
        {
            SoundManager.GetSoundManager().PlayTrash();

            ing.Reset();
        }
    }