コード例 #1
0
    private void DropIngredient()
    {
        PrepCounter counter = mCurrentCollider.GetComponent <PrepCounter>();

        if (counter != null && !counter.InUse && mServingBowl == null)
        {
            if (mIngredientPicked.Count > 0)
            {
                StopPlayerMovement(true);
                counter.StartPrep(mIngredientPicked.Peek().GetData(), OnPrepDone);

                ActiveIngredientData data = mIngredientPicked.Dequeue();
                Destroy(data.GetObject());

                int Idx = 1;
                foreach (ActiveIngredientData iData in mIngredientPicked.ToArray())
                {
                    iData.GetObject().transform.localPosition = Vector3.up * mPickupPositionMultiplier * Idx;
                    Idx += 1;
                }
            }
            else
            {
                counter.TryPickup(OnPickupDone);
            }
        }
    }
コード例 #2
0
    public void TransferToPlate(IngredientData data, Action callback)
    {
        mCurrentData      = data;
        OnTrasferringDone = callback;

        GameObject obj = Instantiate <GameObject>(mCurrentData.ChoppedObject, mSpawn.position * (ItemsInPlate.Count > 0?ItemsInPlate.Count:1), Quaternion.identity, transform);

        obj.transform.localPosition = Vector3.up * mObjectPositionMultiplier * (ItemsInPlate.Count > 1 ? ItemsInPlate.Count : 1);
        obj.transform.localScale   *= mObjectScaleMultiplier;

        ActiveIngredientData iData = new ActiveIngredientData(data, obj);

        ItemsInPlate.Add(iData);

        if (OnTrasferringDone != null)
        {
            OnTrasferringDone();
            OnTrasferringDone = null;
        }
    }
コード例 #3
0
    private void PickupIngredient()
    {
        if (mIngredientPicked.Count >= mMaxPickupCount || mServingBowl != null)
        {
            return;
        }

        IngredientData data = mCurrentCollider.GetComponent <IngredientPlate>().IngredientData;

        if (data.MainObject)
        {
            GameObject           obj   = Instantiate(data.MainObject, transform);
            ActiveIngredientData iData = new ActiveIngredientData(data, obj);

            mIngredientPicked.Enqueue(iData);

            obj.transform.localPosition = Vector3.up * mPickupPositionMultiplier * mIngredientPicked.Count;
            obj.transform.localScale    = Vector3.one * data.ScaleInUse;
        }
    }