Esempio n. 1
0
 public void onFoodDefenced(CalorieFoodObject foodObject)
 {
     addCombo();
     showCalorie(foodObject.calorie);
     addScore(foodObject.calorie);
     showFoodImage(foodObject.imageName);
     CheckFoodCrash(foodObject.foodId);
 }
Esempio n. 2
0
    private GameObject findFoodObject(int foodId)
    {
        for (int i = 0; i < projectiles.Length; ++i)
        {
            CalorieFoodObject currentObject = projectiles[i].GetComponent <CalorieFoodObject>();

            if (currentObject.foodId == foodId)
            {
                return(projectiles[i].gameObject);
            }
        }
        return(null);
    }
Esempio n. 3
0
    private void loadFoodImages()
    {
        if (_foodImageCache == null)
        {
            _foodImageCache = new Hashtable();
        }

        foreach (Transform obj in projectiles)
        {
            CalorieFoodObject foodObject = obj.gameObject.GetComponent <CalorieFoodObject>();
            string            imageName  = "texture/Food/" + foodObject.imageName.Replace(".png", "");
            Texture2D         texture    = Resources.Load <Texture2D>(imageName);

            _foodImageCache.Add(foodObject.imageName, texture);
        }
    }