Example #1
0
    private void OnTriggerEnter(Collider other)
    {
        switch (other.tag)
        {
        case "SittingPoint":
            Chair ch = other.transform.parent.GetComponent <Chair>();
            if (ch.IsAvailable)
            {
                currentChair       = ch;
                agent.enabled      = false;
                transform.position = currentChair.PosB.position;
                //isOnStool = true;
                charactergb.isSitting = true;
                currentChair.Occupied(convsys);
                convsys.lookforConversation(currentChair);
                transform.LookAt(currentChair.DefaultPointToLook);
            }
            break;

        case "Exit":
            Debug.Log("BYE");
            foreach (ConvoSystem cs in convsys.partners)
            {
                cs.partners.Remove(convsys);
            }
            currentChair.IsAvailable = true;
            currentChair.PosA.GetComponent <SphereCollider>().enabled = true;
            Destroy(gameObject);
            break;
        }
    }
    //public void FeedPeople()
    //{
    //    for (int x = 0; x < Person.Count; x++)
    //    {
    //        if(Person[x].At_Table == true && Person[x].HasBeenFed == false)
    //        {
    //            for (int i = 0; i < Inventory.Instance.Consumable_Slot_Count; i++)
    //            {
    //                //return slot with item
    //                int value = Inventory.Instance.GetSlotWithItem(ItemType.Consumable);

    //                if (value != -1)
    //                {
    //                    Inventory.Instance.SellItem(value, Person[x].ConsomeCount);
    //                    Person[x].Feed();
    //                    break;
    //                }
    //            }
    //        }
    //    }
    //}

    public void AddPeople()
    {
        for (int x = 0; x < GuestCount(); x++)
        {
            int indexOfEmptyChair = -1;
            for (int i = 0; i < ChairsInResturant.Count; i++)
            {
                if (ChairsInResturant[i].Empty == true)
                {
                    indexOfEmptyChair = i;
                    break;
                }
                else
                {
                    indexOfEmptyChair = -1;
                }
            }

            if (GuestCount() >= 0 && indexOfEmptyChair != -1)
            {
                Chair currentChair = ChairsInResturant[indexOfEmptyChair];
                AddPerson(10, ChairsInResturant[indexOfEmptyChair]);
                currentChair.Occupied();
                RemoveGuest(1);
            }
        }

        //for (int i = 0; i < Inventory.Instance.Consumable_Slot_Count; i++)
        //{
        //    //return slot with item
        //    int x = Inventory.Instance.GetSlotWithItem(ItemType.Consumable);

        //    if (x != -1)
        //    {
        //        Inventory.Instance.SellItem(x, GuestCount());
        //        RemoveGuest(GuestCount());
        //        break;
        //    }
        //}
    }