Ejemplo n.º 1
0
    private void IngredientOnTheBurger(IngredientSO ingredient)
    {
        _ingredientCount++;
        _ingredientsHeight += ingredient.height;


        if (_allIngredientsOnTheBurger % 10 == 0)
        {
            Wallet.AddActiveMoney();
        }

        // Camera correction by burger height
        if (_ingredientCount == _ingredientsBeforeCorrection)
        {
            Vector3 positionUnderLastIngredient = new Vector3(_lastIngredient.position.x, _startPointToMeasureCorrection.y, _startPointToMeasureCorrection.z);
            float   diff = Vector3.Distance(_lastIngredient.position, positionUnderLastIngredient);


            burgerCorrection = diff - _ingredientsHeight;

            _ingredientsHeight = 0;
            _ingredientCount   = 0;

            _startPointToMeasureCorrection = new Vector3(positionUnderLastIngredient.x, positionUnderLastIngredient.y + diff, positionUnderLastIngredient.z);
        }
    }