Beispiel #1
0
    public void PerfectHit(IngredientSO ingredient, Transform lastIngredient)
    {
        SetLastIngredient(lastIngredient);

        _allIngredientsOnTheBurger++;
        _countPerfectHIt++;

        //SoundManager.instance.BurgerHitSound();

        if (_countPerfectHIt == _perfectHitToStaggerZero)
        {
            Bonuses.StopStagger();
            GameManager.instance.SetPerfektHitFX(lastIngredient.position + Vector3.up / 6);
            SoundManager.instance.PerfectHitSound();

            _countPerfectHIt = 0;
        }
        else
        {
            SoundManager.instance.PerfectHitTypesSound();
        }

        ingredientHit = Hit.Perfect;
        Score.instance.ChangeScoreWhenHit(GameManager.instance.GetPerfectHitScore(), ingredientHit);
        PlayerControl.instance.HitOnTheBurger();


        _missionManager.MissionDo(Hit.Perfect, ingredient);

        IngredientOnTheBurger(ingredient);
    }
Beispiel #2
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);
        }
    }
Beispiel #3
0
    /// <summary>
    /// This adds the ingredient to the cooking appliance in preparation for cooking
    /// </summary>
    /// <param name="ingredient"></param>
    public void AddIngredient(IngredientSO ingredientSO)
    {
        if (!selectedFood)
        {
            return;
        }

        if (!isCooking && cleanTimer <= 0)
        {
            // If the current selected food to cook has this ingredient and
            // there isn't already the ingredient in the cooking appliance
            if (selectedFood.ingredientList.Contains(ingredientSO) && !ingredients.Contains(ingredientSO))
            {
                ingredients.Add(ingredientSO);

                foreach (Image display in ingredientDisplayList)
                {
                    if (display.sprite == ingredientSO.sprite)
                    {
                        // Blacks out the ingredient the player is putting into the cooking appliance
                        Color color = display.color;
                        color         = new Color(0, 0, 0);
                        display.color = color;
                    }
                }
            }

            // Once there are all the needed ingredients
            if (ingredients.Count == selectedFood.ingredientList.Count)
            {
                Cook();
            }
        }
    }
Beispiel #4
0
    public void SetIngredient(ShopContent shopContent, IngredientSO ingredientSO)
    {
        _shopContent = shopContent;


        ingredient  = ingredientSO;
        _name.text  = ingredientSO.name;
        _isSelected = ingredientSO.isSelected;


        _ingredientImage.sprite = ingredientSO.sprite;
        _ingredientImage.gameObject.SetActive(true);

        if (ingredientSO.isAlwaysActive)
        {
            _isSelected             = true;
            ingredientSO.isSelected = true;
            ingredientSO.isLock     = false;
        }


        if (ingredientSO.isLock)
        {
            _ingredientPanelImage.sprite = _lockSprite;
            _ingredientImage.gameObject.SetActive(false);
        }

        _checkBox.SetActive(_isSelected);
    }
    //



    public void MissionDo(Hit hitType, IngredientSO ingredient)
    {
        if (_rendererMissionOnce.GetIsTImerActive() == false)
        {
            _firstMission.IngredientHit(hitType, ingredient);
        }
        if (_rendererMissionWhole.GetIsTImerActive() == false)
        {
            _secondMission.IngredientHit(hitType, ingredient);
        }
    }
Beispiel #6
0
    public static void CreateIngredient()
    {
        IngredientSO asset = CreateInstance <IngredientSO>();

        AssetDatabase.CreateAsset(asset, "Assets/Ingredients/ingredient.asset");
        AssetDatabase.SaveAssets();

        EditorUtility.FocusProjectWindow();

        Selection.activeObject = asset;
    }
Beispiel #7
0
    public void IngredientHit(Hit hitType, IngredientSO ingredient)
    {
        if (hitType != Hit.Fall && _ingredientNameToCollect.Equals(ingredient.name))
        {
            _ingredientsCollected++;

            if (_isMissionFinished == false && IsMissionCompleted())
            {
                _isMissionFinished = true;
                _missionManager.MissionFinished(this);
            }
        }
    }
Beispiel #8
0
    public void FallHit(IngredientSO ingredient)
    {
        _countPerfectHIt = 0;
        GameManager.instance.DepriveHealth();

        ingredientHit = Hit.Fall;
        Score.instance.ChangeScoreWhenHit(GameManager.instance.GetFallHitScore(), ingredientHit);

        SoundManager.instance.BurgerFallSound();
        SoundManager.instance.Vibrate();

        _missionManager.MissionDo(Hit.Fall, null);
    }
Beispiel #9
0
    public void IngredientHit(Hit hitType, IngredientSO ingredient)
    {
        if (hitType == Hit.Perfect)
        {
            _perfectsCollected++;


            if (_isMissionFinished == false && IsMissionCompleted())
            {
                _isMissionFinished = true;
                _missionManager.MissionFinished(this);
            }
        }
    }
Beispiel #10
0
    public void CalculateIngredient(IngredientSO s)
    {
        ingredientAmount = 0;
        for (int i = 0; i < ingredients.Count; i++)
        {
            if (ingredients[i].ingredientSO.ingredientID == s.ingredientID)
            {
                ingredientAmount++;
            }
        }
        float ingredientRatio = (Mathf.Round(ingredientAmount) / ingredients.Count) * 100;

        print("The ingredient <b>" + s + "</b> takes up <b>" + ingredientRatio + "%</b> of the pizza.  Nice one.");
    }
Beispiel #11
0
    public void NormalHit(IngredientSO ingredient, Transform lastIngredient)
    {
        SetLastIngredient(lastIngredient);

        _countPerfectHIt = 0;
        _allIngredientsOnTheBurger++;

        ingredientHit = Hit.Normal;
        Score.instance.ChangeScoreWhenHit(GameManager.instance.GetNormalHitScore(), ingredientHit);
        PlayerControl.instance.HitOnTheBurger();
        SoundManager.instance.BurgerHitSound();

        _missionManager.MissionDo(Hit.Normal, ingredient);

        IngredientOnTheBurger(ingredient);
    }
 public void ShowIngredientInfo(IngredientSO ingredientInfo)
 {
     if (ingredientInfo.isLock)
     {
         _name.text   = "???";
         _kcal.text   = "";
         _height.text = "";
         _mass.text   = "";
     }
     else
     {
         _name.text   = ingredientInfo.name;
         _kcal.text   = ingredientInfo.kcal + " kcal";
         _height.text = (ingredientInfo.height * 10) + " cm.";
         _mass.text   = ingredientInfo.mass + " g.";
     }
 }
Beispiel #13
0
    public void ClearAll()
    {
        _lastIngredient = null;
        _healthComponent.SetStartHealth();
        _scoreComponent.ResetScore();
        _scoreComponent.gameObject.SetActive(false);

        GameOver.instance.ResetData();
        _playerController.ResetData();
        _throwDirection.ResetData();
        _ingredientBuffer.HideIngredients();
        _burger.ResetBurgers();


        // default Camera position
        _mainCamera.transform.position = _defaultCameraPosition;
        _mainCamera.transform.rotation = _defaultCameraRotation;
    }
Beispiel #14
0
    public IngredientSO GetRandomIngredient()
    {
        if (_lastIngredient == null)
        {
            // First throw
            _lastIngredient = _unlockIngredients[0];
            return(_lastIngredient);
        }
        else
        {
            int indexIngredient = Random.Range(0, _unlockIngredients.Length);

            if (GetSpecialIngredient(indexIngredient) == _lastIngredient)
            {
                indexIngredient = indexIngredient + 1 == _unlockIngredients.Length ? 0 : indexIngredient + 1;
            }

            _lastIngredient = _unlockIngredients[indexIngredient];
            return(_unlockIngredients[indexIngredient]);
        }
    }
Beispiel #15
0
    private void OnEnable()
    {
        if (_shopContent.allLocketIngredients > 0)
        {
            int randomLockIndex   = GetRandomLock();
            int ingredientSOIndex = _shopContent.GetLockIngredientByIndex(ref randomLockIndex);


            unlockIngredient = _shopContent.UnblockIngredient(ingredientSOIndex, randomLockIndex);

            _shopContent.SelectedIngredient();

            _shopPanel.SetActive(false);
            _animation.Play();

            _randomIngredientImage.sprite = unlockIngredient.sprite;
        }
        else
        {
            CloseRandomPurchasesPanel();
        }
    }
 public void IngredientHit(Hit hitType, IngredientSO ingredient)
 {
 }
 /// <summary>
 /// Add an Ingredient to the list.
 /// </summary>
 /// <param name="ingredient"></param>
 public void AddIngredient(IngredientSO ingredientToAdd)
 {
     orderInProgress.list.Add(ingredientToAdd);
 }
 /// <summary>
 /// Externally configure Slot.
 /// </summary>
 /// <param name="keystroke">What to show to the Player.</param>
 /// <param name="ingredient">Which Ingredient this Slot adds.</param>
 /// <param name="ingredientIcon">The graphic to display.</param>
 public void ConfigureSlot(string keystroke, IngredientSO ingredient, Sprite ingredientIcon)
 {
     this.keystrokeTMP.text     = keystroke;
     this.ingredient            = ingredient;
     this.ingredientIcon.sprite = ingredientIcon;
 }
 /// <summary>
 /// Externally configure Slot.
 /// </summary>
 /// <param name="keystroke">What to show to the Player.</param>
 /// <param name="ingredient">Which Ingredient this Slot adds.</param>
 public void ConfigureSlot(IngredientSO ingredient, int keystroke)
 {
     ConfigureSlot(keystroke, ingredient, ingredient.Icon);
 }
 /// <summary>
 /// Externally configure Slot.
 /// </summary>
 /// <param name="keystroke">What to show to the Player.</param>
 /// <param name="ingredient">Which Ingredient this Slot adds.</param>
 /// <param name="ingredientIcon">The graphic to display.</param>
 public void ConfigureSlot(int keystroke, IngredientSO ingredient, Sprite ingredientIcon)
 {//base
     this.keystrokeTMP.text     = keystroke.ToString();
     this.ingredient            = ingredient;
     this.ingredientIcon.sprite = ingredientIcon;
 }
 /// <summary>
 /// Init this Slot externally.
 /// </summary>
 /// <param name="ingredient"></param>
 /// <param name="sprite"></param>
 /// <param name="keystroke"></param>
 public void InitSlot(IngredientSO ingredient, Sprite sprite, int keystroke)
 {
     this.ingredient            = ingredient;
     this.ingredientIcon.sprite = sprite;
     this.keystrokeTMP.text     = keystroke.ToString();
 }
Beispiel #22
0
 public void SetIngredientInfo()
 {
     _info = GameManager.instance.GetRandomIngredient();
 }