Пример #1
0
    }//PickAnyFromMenu

    public void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.tag.ToLower() != "pedestrian")
        {
            return;
        }

        BasicAI pedestrian = collision.GetComponent <BasicAI>();

        if (pedestrian == null)
        {
            return;
        }

        bool isPriceGood = District.Instance.TryAttactByPrice(Recepe.Price);

        if (!isPriceGood)
        {
            Debug.Log("Bad Price!");
            return;
        }

        bool isRecepeGood = District.Instance.TryAttractByRecepe(
            ref Recepe.Brains, ref Recepe.Seasoning, ref Recepe.Drinks);

        if (!isRecepeGood)
        {
            Debug.Log("Bad Recepe!");
            return;
        }

        pedestrian.SetState(BasicAI.StateMachine.standingInLine);
        waitingQueue.Add(pedestrian);
    } //OnTriggerEnter2D