Пример #1
0
    // Overloaded function calls the appropriate controller function based on eventPath message and passes in the GameObject that will have changes made to it.
    public void OnNotification(string eventPath, GameObject target)
    {
        switch (eventPath)
        {
        // Adds clock to spawnedClocks list and creates/adds ClockView and ClockModel to respective lists, generates a position for the clock, resets clock index and initialises Clock values.
        case InteractableClockNotification.OnClockEnable:
            clock.OnClockEnable(target);
            break;

        // Removes clock from spawnedClocks the lists: GameObject, ClockView and Models in the Clock Manager.
        case InteractableClockNotification.OnClockDisable:
            clock.OnClockDisable(target);
            break;

        // Generate a random position on the screen and sets the clock position to this.
        case InteractableClockNotification.GeneratePosition:
            clockManager.GenerateNewPosition(target);
            break;

        // Removes the clock passed into this function from the list of spawned clocks and deletes the clock GameObject.
        case InteractableClockNotification.RemoveClock:
            clockManager.RemoveClock(target);
            break;
        }
    }