public void Reset() { // TODO unsubscribe from events // return to pool if (ingredientVisual != null) { MainLogic.GetMainLogic().GetEntityManager().ReturnEntity(ingredientVisual); ingredientVisual = null; } }
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); }
// 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); }
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); }
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); }
void OnGarbage(IngredientVisual trash) { Ingredient ing = null; ing = GetIngredient(trash); if (ing == null) { ing = GetGarbage(trash); } if (ing != null) { SoundManager.GetSoundManager().PlayTrash(); ing.Reset(); } }