Пример #1
0
    IEnumerator SpawnClownerCust()
    {
        yield return(new WaitForSeconds(2));

        clownerCust.SetActive(true);
        TutFindPlayer findPlayerAi = clownerCust.GetComponent <TutFindPlayer>();

        if (findPlayerAi)
        {
            findPlayerAi.SetReachedPlayerCallback(() => {
                movementController.DisableMovementOfPlayer();
                Dialogue clownerDialogue = DialogueParser.Parse(
                    "{[R]1}Rumour has it that the one behind this chaos is a clown-" +
                    "{[R]1}Wait... What's that sound?");
                dialogueLoader.LoadAndRun(clownerDialogue, customerController);
                dialogueLoader.SetDialogueEndCallback(() => {
                    Debug.Log("Meet Donald McRonald in 2.5 seconds");
                    StartCoroutine(LoadGameScene());
                });
            });
        }
    }
Пример #2
0
    IEnumerator SpawnFinalCust()
    {
        yield return(new WaitForSeconds(2)); // can adjust this longer/shorter as you deem fit

        clownerCust.SetActive(true);
        TutFindPlayer findPlayerAi = clownerCust.GetComponent <TutFindPlayer>();

        if (findPlayerAi)
        {
            findPlayerAi.SetReachedPlayerCallback(() => {
                movementController.DisableMovementOfPlayer();
                Dialogue clownerDialogue = DialogueParser.Parse(
                    "{[R]1}Hey chef, thanks for the happy meal-" +
                    "{[R]1}Knowing the monsters are gone really puts a smile to our faces :)" +
                    "{[R]1}Thank you for restoring peace to the town!");
                dialogueLoader.LoadAndRun(clownerDialogue, customerController);
                dialogueLoader.SetDialogueEndCallback(() => {
                    Debug.Log("Rolling the credits ~");
                    ShowCredits(); // not sure if should change this to coroutine?
                });
            });
        }
    }
Пример #3
0
    // Update is called once per frame
    void Update()
    {
        if (!holdingItem && Keybinds.WasTriggered(Keybind.Interact))
        {
            GameObject closestFoodItem = FindClosestWithTag("FoodToServe");
            if (closestFoodItem)
            {
                // Pick up food from counter
                string selectedDish = closestFoodItem.name;
                selectedDish = selectedDish.Remove(selectedDish.Length - 7); // Remove the "(Clone)"


                int foodId = -2;

                /*
                 * if (selectedDish == ("plateDinner(Clone)") )
                 *  foodId = 0;
                 * else if (selectedDish == ("bowlBroth(Clone)") )
                 *  foodId = 1;
                 * else if (selectedDish == ("pizza(Clone)") )
                 *  foodId = 2;
                 * else if (selectedDish == ("burrito(Clone)") )
                 *  foodId = 3;
                 */
                for (int i = 0; i < foodPrefabs.Length; i++)
                {
                    if (foodPrefabs[i].name == selectedDish)
                    {
                        foodId = i;
                        break;
                    }
                }
                CollectFood(foodId, foodLocation.position);
                Destroy(closestFoodItem); // comment this out if want unlimited servings of the dish after cooking
            }
            else
            {
                // Try interacting with closest Customer
                GameObject closestCustomer = FindClosestWithTag("Customer");
                // Serve the customer if carrying food
                if (closestCustomer)
                {
                    Restaurant_CustomerController customerController =
                        closestCustomer.GetComponent <Restaurant_CustomerController>();
                    // Only serve food to Customers not already eating
                    if (customerController.HasReceivedFood() && customerController.HasDialogue())
                    {
                        movementController.DisableMovementOfPlayer();
                        dialogueLoader.LoadAndRun(DialogueDatabase.GetRandomDialogue(), customerController);
                        customerController.SetToNoDialogue();
                    }
                }
            }
        }
        else if (holdingItem && Keybinds.WasTriggered(Keybind.Trash))
        {
            DestroyHeldFood();
        }
        else if (holdingItem && Keybinds.WasTriggered(Keybind.Interact))
        {
            GameObject closestCustomer = FindClosestWithTag("Customer");
            // Serve the customer if carrying food
            if (closestCustomer)
            {
                Restaurant_CustomerController customerController =
                    closestCustomer.GetComponent <Restaurant_CustomerController>();
                // Only serve food to Customers not already eating
                if (!customerController.HasReceivedFood())
                {
                    ServeFood(closestCustomer, currentHeldFood);
                }
            }
        }
    }