Beispiel #1
0
    public override void OnInteract(MasterChef chef)
    {
        if (BELONGS_TO != chef.playerType)
        {
            return;
        }

        if (transform.childCount == 0)
        {
            Debug.Log("check if hand is empty");
            //take food
            if (!chef.IsHandEmpty())
            {
                chef.GetFoodFromHand(this);
            }
            else
            {
                Debug.Log("hand is empty");
            }
        }
        else
        {
            //give food
            Food foodOnTray = GetComponentInChildren <Food>();
            foodOnTray.transform.SetParent(chef.transform);
            foodOnTray.transform.DOLocalMove(Vector3.zero, 0.3f).OnComplete(() => { chef.AddItemToHand(foodOnTray); Destroy(foodOnTray.gameObject); });
        }
    }
Beispiel #2
0
    public override void OnInteract(MasterChef chef)
    {
        if (BELONGS_TO != chef.playerType)
        {
            return;
        }

        //IF THE CHEF HAS FOOD IN HIS HAND
        if (!chef.IsHandEmpty())
        {
            currentChef = chef;
            chef.GetFoodFromHand(this);
            StartCutting();
        }

        //DOES THIS CUTTING BOARD HAS SALAD
        else if (transform.GetComponentInChildren <Food>() != null)
        {
            Food[] allCutFood = GetComponentsInChildren <Food>();
            for (int i = 0; i < allCutFood.Length; i++)
            {
                itemsInCuttingBoard.Add(allCutFood[i].KEY);
                if (i != 0)
                {
                    allCutFood[i].transform.SetParent(allCutFood[0].transform);
                }
            }
            allCutFood[0].transform.SetParent(chef.saladHolder);
            Vector3  foodScale = allCutFood[0].transform.localScale;
            Sequence sequence  = DOTween.Sequence();
            sequence.Append(allCutFood[0].transform.DOLocalMove(Vector3.zero, 0.3f));
            sequence.Append(allCutFood[0].transform.DOScale(Vector3.zero, 0.3f));
            chef.SaladInHandIndicator(true, foodScale);
        }
    }
Beispiel #3
0
 public override void OnInteract(MasterChef chef)
 {
     if (chef.HasSalad())
     {
         chef.ThrowSalad(this.transform);
     }
     else if (!chef.IsHandEmpty())
     {
         chef.GetFoodFromHand(this, true);
     }
 }