Example #1
0
    static public Ingredient Grab(INGREDIENT_TYPE ingredientType)
    {
        Ingredient retVal = null;

        if (!m_spawnLists.ContainsKey(ingredientType))
        {
            return(retVal);
        }

        if (m_spawnLists[ingredientType].Count > 1)
        {
            int index = 1;

            retVal = m_spawnLists[ingredientType][index];

            m_spawnLists[ingredientType].RemoveAt(index);
        }
        else
        {
            retVal = Instantiate(m_spawnLists[ingredientType][0]);
        }

        if (retVal.m_grabbedByPlayer)
        {
            Debug.Log("What the?");
        }

        if (retVal != null)
        {
            retVal.InstanceInit();
            retVal.gameObject.SetActive(true);
            retVal.ActivateCollision(false);

            retVal.transform.SetParent(null);
            retVal.transform.localScale = m_spawnLists[ingredientType][0].transform.localScale;
        }

        if (!SanityCheck(retVal))
        {
            Debug.Log("On my ever living...");
        }

        return(retVal);
    }