예제 #1
0
    private void SignalWarning(List <AnimalSpecies> endangeredSpecies)
    {
        // Setup the message
        string message = "Some animal populations are rapidly declining. Please improve their needs as soon as possible.";

        message += "\n\nEndangered species: ";
        message += string.Join(", ", endangeredSpecies.Select(animal => animal.SpeciesName));

        // Set the message text and open the window
        warningWindow.MessageText.text = message;
        warningWindow.Open();
    }
예제 #2
0
    private void OpenWindow(GenericWindow window, UnityAction primaryAction, UnityAction secondaryAction = null)
    {
        // Instantiate the window under the main canvas
        Transform canvas = GameObject.FindWithTag("MainCanvas").transform;

        window = Instantiate(window, canvas);

        // Setup the primary and secondary action of the window
        window.AddPrimaryAction(primaryAction);
        if (secondaryAction != null)
        {
            window.AddSecondaryAction(secondaryAction);
        }

        // Open the window
        window.Open();
    }