Beispiel #1
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;
        }
    }
Beispiel #2
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;
        }
    }