Esempio n. 1
0
    // All interactable objects should call this method as the start
    // Returns false if object has already been registered
    public bool RegisterObject(string objectName, System.Action objectAction, int timeConsumption)
    {
        if (registeredObjects.ContainsKey(objectName))
        {
            Debug.LogWarning("Object " + objectName + " was already registered");
            return(false);
        }

        Debug.Log("Registering object '" + objectName + "'");
        valueRegistry.Set($"Used {objectName}", 0);
        registeredObjects.Add(objectName, new System.Action(() =>
        {
            objectAction();
            Tracking.Instance.AddUsedTime(timeConsumption);
        }));
        objectNeglection.Add(objectName, true);
        return(true);
    }
Esempio n. 2
0
    //Moves the character to the bed to move on to the next day
    private void Sleep()
    {
        void CallbackAction()
        {
            /* Code in this method will get called when the character is next to the bed and ready to sleep
             * Sleep animation should start playing, sleep theme should start playing, etc
             * Probably should disable the Movement2D.cs script too */

            print("Sleeping");
            treeWater.dayUpdate();

            //TODO: Uncomment when computer and room scenes get integrated
            //ProfileScreen.Instance.ResetTodaysActivityTimes();
            DayNum++;

            InteractionHandler.Instance.UpdateNeglectedSprites();
            ProductivityAid.Instance.UpdateLevel();

            // Present Agenda dialogue
            valueRegistry.Set("Day Number", DayNum);

            // Set destination to move to upon waking up
            Vector3 targetPosition;

            switch (DayNum)
            {
            case 2:
                agendasBox.SetActive(true);
                targetPosition = agendasBox.transform.position + Vector3.left;
                break;

            default:
                targetPosition = agendasBox.transform.position + Vector3.left;
                break;
            }

            Movement2D.Instance.MoveTo(targetPosition, () => {
                // Have agenda speak once Quinn arrives
                dialogueSystem.Present(agendaDialogue);
            });
        }

        Movement2D.Instance.MoveTo(bedDestination.position, CallbackAction);
    }