Beispiel #1
0
    public void TryAddFood(CookableFood food)
    {
        var requiredFood = food.GetRequiredHeadIngredients();

        if (requiredFood.Count != 0)
        {
            var containsIngredient = false;
            for (var i = 0; i < requiredFood.Count; ++i)
            {
                if (requiredFood[i] == null || _food.Contains(requiredFood[i]))
                {
                    containsIngredient = true;
                    break;
                }
            }

            if (!containsIngredient || !_food[_food.Count - 1].IsCooked(false))
            {
                return;
            }
        }

        _food.Add(food);
        food.transform.SetParent(_foodNode.transform);
        food.transform.localPosition = new Vector3(0, 0, 0);
        food.cookingPan = this;
        Notify(new CookingStartEvent(this, food));
        _foodIsCooked = false;
    }
Beispiel #2
0
 public void RemoveFood(CookableFood food)
 {
     if (_food.Remove(food))
     {
         Notify(new CookingStopEvent(this, food));
         food.cookingPan = null;
     }
 }
Beispiel #3
0
 public InternalTimer(Mobile from, IPoint3D p, Map map, CookableFood cookableFood) : base(
         TimeSpan.FromSeconds(5.0))
 {
     m_From         = from;
     m_Point        = p;
     m_Map          = map;
     m_CookableFood = cookableFood;
 }
    private void OnTriggerEnter(Collider other)
    {
        Rigidbody rb = other.attachedRigidbody;

        if (rb == null)
        {
            return;
        }

        List <Item> itens = new List <Item>();

        //Check if it's a stick
        Stick stick = rb.GetComponent <Stick>();

        if (stick != null)
        {
            for (int i = 0; i < stick.grabbedItens.Count; i++)
            {
                CookableFood food = stick.grabbedItens[i].GetComponent <CookableFood>();

                //The ingredient is only valid if it's not raw nor burnt
                if (food != null && food.state != CookState.WellDone)
                {
                    continue;
                }

                Item stickItem = stick.grabbedItens[i].GetComponent <Item>();
                itens.Add(stickItem);
            }

            stick.GetComponent <PoolableObject>().ReturnToPool();
        }
        else
        {
            //Anything that is not in a stick
            Item item = rb.GetComponent <Item>();

            if (item != null)
            {
                itens.Add(item);
            }
        }

        orderDelivered?.Invoke(itens);
    }
 public CookingStopEvent(CookingPan pan, CookableFood food) : base(pan)
 {
     this.pan  = pan;
     this.food = food;
 }
Beispiel #6
0
 public InternalTarget(CookableFood item) : base(1, false, TargetFlags.None) => m_Item = item;