Пример #1
0
    /// <summary>
    /// Get supplies after waiting for a certain amount of time.
    /// </summary>
    /// <param name="bellhop">Bellhop script interacting with the supplies.</param>
    /// <returns></returns>
    private IEnumerator GetSupplies(Bellhop bellhop)
    {
        yield return(new WaitForSeconds(secondsToWait));

        bellhop.itemManager.AddItemToHands(ItemType.CleaningSupplies);
        bellhop.Interacted.Invoke();
    }
Пример #2
0
    /// <summary>
    /// Cleans the room after having waited a certain amount of time.
    /// Removes Cleaning Supply from the Bellhop.
    /// </summary>
    /// <param name="bellhop">Bellhop who cleans the room.</param>
    /// <returns></returns>
    private IEnumerator CleanRoom(Bellhop bellhop)
    {
        yield return(new WaitForSeconds(2f));

        ShouldClean(false);
        availableToGuests = true;
        bellhop.itemManager.RemoveItemFromHands(ItemType.CleaningSupplies);
        bellhop.Interacted.Invoke();
    }
Пример #3
0
    /// <summary>
    /// Interacts with Bellhop. If the Bellhop has cleaning supplies and the room has to be cleaned then the Coroutine CleanRoom is called.
    /// </summary>
    /// <param name="gameObject">Bellhop's GameObject.</param>
    private void InteractWithBellhop(GameObject gameObject)
    {
        Bellhop bellhop = gameObject.GetComponent <Bellhop>();

        if (bellhop.itemManager.HasItem(ItemType.CleaningSupplies) && shouldClean)
        {
            StartCoroutine(CleanRoom(bellhop));
        }
        else
        {
            bellhop.Interacted.Invoke();
        }
    }
Пример #4
0
    /// <summary>
    /// If Guest is touched during checking in then the rooms wil be highlighted and the guest will be selected.
    /// If Guest is touched uring checking out then the guest will be checked out, money will be added by the moneyhandler and objectivehandler and the selectedGuest will be set to null.
    /// </summary>
    /// <param name="collider">Collider of touched GameObject.</param>
    /// <param name="moneyHandler">Reference to the moneyHandler.</param>
    /// <param name="objectiveHandler">Reference to the objectiveHandler.</param>
    /// <param name="selectedGuest">Actual Reference to the selectedGuest in the TouchInput Script.</param>
    /// <param name="bellhop">Actual Reference to the bellhop in the TouchInput Script.</param>
    public override void TouchInteract(Collider2D collider, MoneyHandler moneyHandler, ObjectiveHandler objectiveHandler, ref Guest selectedGuest, ref Bellhop bellhop)
    {
        Guest guest = collider.GetComponent <Guest>();

        if (guest.checkIn)
        {
            selectedGuest = guest;
            selectedGuest.navigator.HighlightRooms(true);
            return;
        }
        else if (guest.checkOut)
        {
            moneyHandler.CheckOut();
            objectiveHandler.AddObjectiveAmount(1, ObjectiveType.Keys);
            guest.checkOut = false;
            guest.CheckOut();
            selectedGuest = null;
            return;
        }
    }
Пример #5
0
    /// <summary>
    /// Give the bellhop cleaning supplies
    /// </summary>
    /// <param name="gameObject">GameObject Interacting with the NavigationInteraction.</param>
    public override void NavInteract(GameObject gameObject)
    {
        Bellhop bellhop = gameObject.GetComponent <Bellhop>();

        StartCoroutine(GetSupplies(bellhop));
    }
Пример #6
0
    /// <summary>
    /// If Room is touched while a guest is selected and the room is available then the guest will be sent to the room and will be checked in.
    /// Else if the Bellhop is not null and the room should be cleaned then the room wil not be available to guests and the bellhop is sent over to clean it.
    /// Selected guest is always set to null if one was selected.
    /// </summary>
    /// <param name="collider">Collider of touched GameObject.</param>
    /// <param name="moneyHandler">Reference to the moneyHandler.</param>
    /// <param name="objectiveHandler">Reference to the objectiveHandler.</param>
    /// <param name="selectedGuest">Actual Reference to the selectedGuest in the TouchInput Script.</param>
    /// <param name="bellhop">Actual Reference to the bellhop in the TouchInput Script.</param>
    public override void TouchInteract(Collider2D collider, MoneyHandler moneyHandler, ObjectiveHandler objectiveHandler, ref Guest selectedGuest, ref Bellhop bellhop)
    {
        Room            room     = collider.GetComponent <Room>();
        NavigationPoint navPoint = room.navigationPoint;

        if (selectedGuest & room.availableToGuests)
        {
            List <Vector2> route = selectedGuest.GetRoute(selectedGuest.currentPosition, navPoint);
            if (route != null)
            {
                selectedGuest.navigator.HighlightRooms(false);
                selectedGuest.SetRoute(route, room);
                selectedGuest.checkIn = false;
                selectedGuest.CheckIn();
                moneyHandler.CheckIn();
                room.DoorState(false);
            }
        }
        else if (bellhop)
        {
            if (room.shouldClean)
            {
                room.availableToGuests = false;
                bellhop.AddInteractionToQueue(room);
            }
        }

        if (selectedGuest)
        {
            selectedGuest.navigator.HighlightRooms(false);
            selectedGuest = null;
        }
    }
Пример #7
0
 /// <summary>
 /// Interaction method when touching something.
 /// </summary>
 /// <param name="collider">Collider of touched GameObject.</param>
 /// <param name="moneyHandler">Reference to the moneyHandler.</param>
 /// <param name="objectiveHandler">Reference to the objectiveHandler.</param>
 /// <param name="selectedGuest">Actual Reference to the selectedGuest in the TouchInput Script.</param>
 /// <param name="bellhop">Actual Reference to the bellhop in the TouchInput Script.</param>
 public abstract void TouchInteract(Collider2D collider, MoneyHandler moneyHandler, ObjectiveHandler objectiveHandler, ref Guest selectedGuest, ref Bellhop bellhop);
Пример #8
0
    /// <summary>
    /// Bellhop gets the supply NavigationInteraction added to it's queue.
    /// Selected guest is set to null and rooms highlights will disappear.
    /// </summary>
    /// <param name="collider">Collider of touched GameObject.</param>
    /// <param name="moneyHandler">Reference to the moneyHandler.</param>
    /// <param name="objectiveHandler">Reference to the objectiveHandler.</param>
    /// <param name="selectedGuest">Actual Reference to the selectedGuest in the TouchInput Script.</param>
    /// <param name="bellhop">Actual Reference to the bellhop in the TouchInput Script.</param>
    public override void TouchInteract(Collider2D collider, MoneyHandler moneyHandler, ObjectiveHandler objectiveHandler, ref Guest selectedGuest, ref Bellhop bellhop)
    {
        if (bellhop)
        {
            NavigationInteraction supply = collider.GetComponent <NavigationInteraction>();
            bellhop.AddInteractionToQueue(supply);

            if (selectedGuest)
            {
                selectedGuest.navigator.HighlightRooms(false);
                selectedGuest = null;
            }
        }
    }