Example #1
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);
        }
    }
Example #2
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); });
        }
    }
Example #3
0
 public override void OnInteract(MasterChef chef)
 {
     if (chef.HasSalad())
     {
         chef.ThrowSalad(this.transform);
     }
     else if (!chef.IsHandEmpty())
     {
         chef.GetFoodFromHand(this, true);
     }
 }
Example #4
0
    public override void OnInteract(MasterChef chef)
    {
        if (chef.IsHandFull())
        {
            return;
        }
        Food newFood     = DataManager.instance.GetFoodWithKey(KEY);
        Food foodSpawned = Instantiate(newFood, transform.position, Quaternion.identity);

        foodSpawned.transform.SetParent(chef.transform);
        foodSpawned.transform.DOLocalMove(Vector3.zero, 0.3f).OnComplete(() => { chef.AddItemToHand(foodSpawned); Destroy(foodSpawned.gameObject); });
    }
Example #5
0
    void Awake()
    {
        mMasterChef = GameStarter.Instance.MasterChef();

        for (int i = 0; i < 4; i++)
        {
            mStartPositinos[i] = transform.Find("StartPos" + (i + 1)).gameObject;
        }
        mGB = GameStarter.Instance.BG();
        mCurrentState = State.Menu;
    }
Example #6
0
 public virtual void OnInteract(MasterChef chef)
 {
 }