Esempio n. 1
0
    void Awake()
    {
        if (clearPrefs) {
            PlayerPrefs.SetString("hasUsed", "");
        }
        if (!firstStart)
        {
            firstStart = true;
            Instance = this;
            ingredientsManager = new IngredientsManager(myIngredientsGrid);
            favoriteRecipes = new List<string>();

            Debug.Log(PlayerPrefs.GetString("favorites"));
            favorites = PlayerPrefs.GetString("favorites").Split(',');
            foreach (string s in favorites)
            {
                if (s != "")
                {
                    favoriteRecipes.Add(s);
                    string[] vals = s.Replace("{", "").Replace("}","").Split(';');
                    favoritesPanel.Instance.drawFavorite(vals[1],vals[0],vals[2]);
                }
            }
            loadCategories();
        }
        if (PlayerPrefs.GetString("hasUsed") == "")
        {
            tutorialPanel.SetActive(true);
        }
        PlayerPrefs.SetString("hasUsed", "hasUsed");
    }
Esempio n. 2
0
    public static Recipe Random(int n, IngredientsManager mgr)
    {
        Recipe recipe = new Recipe();

        recipe.Ingredients = mgr.GetRandomIngredients(n);
        return(recipe);
    }
 private void Awake()
 {
     if (instance != null)
     {
         Debug.LogError("More than one Manager in scene!");
     }
     instance = this;
 }
Esempio n. 4
0
 private void Awake()
 {
     if (Instance != null && Instance != this)
     {
         Destroy(this.gameObject);
     }
     else
     {
         Instance = this;
     }
 }
Esempio n. 5
0
    private void Start()
    {
        GameManager        gm        = FindObjectOfType <GameManager>();
        IngredientsManager ingredMgr = FindObjectOfType <IngredientsManager>();

        Ingredient[] spawns = ingredMgr.SpawnIngredients(gm.GoalRecipe.Ingredients);
        for (int i = 0; i < spawns.Length; ++i)
        {
            int j = spawns.Length - 1 - i;
            spawns[j].transform.position = transform.position + Vector3.up * (4 * i + baseOffset);
            spawns[j].GetComponent <DraggableObject>().draggable = false;
            spawns[j].GetComponent <Rigidbody2D>().gravityScale  = 0;
        }
    }
Esempio n. 6
0
    private void Start()
    {
        GameManager        gm        = FindObjectOfType <GameManager>();
        IngredientsManager ingredMgr = FindObjectOfType <IngredientsManager>();

        List <Ingredient> spawns = new List <Ingredient>();

        spawns.AddRange(ingredMgr.SpawnIngredients(gm.GoalRecipe.Ingredients));
        spawns.AddRange(ingredMgr.SpawnIngredients(ingredMgr.GetRandomIngredients(n - spawns.Count)));
        Ingredient[] shuffled = ShuffleArray(spawns.ToArray());

        for (int i = 0; i < n / 2; ++i)
        {
            shuffled[i].transform.position             = spawnPointsLeft[0].position + Vector3.right * (3 * i);
            shuffled[i].GetComponent <Hover>().enabled = false;
        }
        for (int i = 0; i < n / 2; ++i)
        {
            shuffled[i + (n / 2)].transform.position             = spawnPointsLeft[1].position + Vector3.right * (3 * i);
            shuffled[i + (n / 2)].GetComponent <Hover>().enabled = false;
        }
    }
Esempio n. 7
0
        void IngEvalVote()
        {
            //Print out the votes
            for (int i = 0; i < 3; i++)
            {
                Debug.Log("Ingredient " + (i + 1) + " has " + ingVoteCounter[i] + " votes");
            }
            //max voteCounter => spawnInfo
            int maxValue = ingVoteCounter.Max();
            int maxIndex = ingVoteCounter.ToList().IndexOf(maxValue);

            //@Dorota
            ingSpawnInfo result = choices[maxIndex];
            //Find the spawning script and spawn ingredients according to poll results
            GameObject         ingredientsManager       = GameObject.Find("IngredientsManager");
            IngredientsManager ingredientSpawningScript = ingredientsManager.GetComponent <IngredientsManager>();

            ingredientSpawningScript.SpawnIngredient(result.IngredientName, result.SpawnPoint);

            GetComponent <PlaySounds>().playSpawn();
            //     Debug.Log("Result: " + result.IngredientName + " " + result.SpawnPoint);
            //    Debug.Log("-------------------------");
        }
    // Start is called before the first frame update
    void Start()
    {
        ingredientsManager = IngredientsManager.instance;

        agua.state       = Ingredient.IngredientState.RAW;
        aguacate.state   = Ingredient.IngredientState.RAW;
        bolillo.state    = Ingredient.IngredientState.RAW;
        carne.state      = Ingredient.IngredientState.RAW;
        cebolla.state    = Ingredient.IngredientState.RAW;
        chileRojo.state  = Ingredient.IngredientState.RAW;
        chileVerde.state = Ingredient.IngredientState.RAW;
        chocolate.state  = Ingredient.IngredientState.RAW;
        cilantro.state   = Ingredient.IngredientState.RAW;
        elote.state      = Ingredient.IngredientState.RAW;
        frijoles.state   = Ingredient.IngredientState.RAW;
        jamon.state      = Ingredient.IngredientState.RAW;
        crema.state      = Ingredient.IngredientState.RAW;
        pollo.state      = Ingredient.IngredientState.RAW;
        queso.state      = Ingredient.IngredientState.RAW;
        tomate.state     = Ingredient.IngredientState.RAW;
        tortillas.state  = Ingredient.IngredientState.RAW;
        totopos.state    = Ingredient.IngredientState.RAW;
    }
Esempio n. 9
0
    /// <summary>
    /// Iniciar nivel. Ningun cliente se ha desmayado, ninguno ha sido servido.
    /// Chef empieza cocinando, no serviendo. Usar el chef según lo que seleccionó el jugador.
    /// Initialize level. No clients have fainted, none have been served.
    /// Chef starts out cooking, not delivering. Use correct chef based on what player chose.
    /// </summary>
    protected void Init()
    {
        FaintedClients   = 0;
        SatisfiedClients = 0;

        cubeSideIndex = 5;
        chefState     = ChefState.COOKING;

        chefIndex          = PlayerPrefs.GetInt("ChefSelected");
        ingredientsManager = IngredientsManager.instance;

        if (chefIndex == 0)
        {
            anim = GameObject.Find("ChefMujer").GetComponent <Animator>();
        }

        if (chefIndex == 1)
        {
            anim = GameObject.Find("ChefHombre").GetComponent <Animator>();
        }

        source = GameObject.Find("MainCamera").GetComponent <AudioSource>();
    }
Esempio n. 10
0
 public IngredientsController(IngredientsManager ingredient)
 {
     IngredientActions = ingredient;
 }
Esempio n. 11
0
 public void Start()
 {
     manager = GameObject.Find("IngredientsManager").GetComponent <IngredientsManager>();
 }