Ejemplo n.º 1
0
    void Start()
    {
        List <Monster> monsters = MGMT_Xml.GetDefaultMonsters();

        foreach (Monster monster in monsters)
        {
            monster.Display();
        }
    }
Ejemplo n.º 2
0
    /// <summary>
    /// Returns a List of all the names of the <see cref="Adventurer"/>
    /// </summary>
    /// <returns> A List of all the names of the <see cref="Adventurer"/> </returns>
    public static List <string> GetAdventurersNames()
    {
        List <Adventurer> adventurers = MGMT_Xml.GetAdventurers();
        List <string>     list        = new List <string>();

        foreach (Adventurer adventurer in adventurers)
        {
            list.Add(adventurer.name);
        }

        return(list);
    }
Ejemplo n.º 3
0
    /// <summary>
    /// Returns an <see cref="Adventurer"/> from its name
    /// </summary>
    /// <param name="name"> Name of the <see cref="Adventurer"/> </param>
    /// <returns> An Adventurer instance corresponding the parameter name </returns>
    public static Adventurer GetAdventurerFromName(string name)
    {
        List <Adventurer> adventurers = MGMT_Xml.GetAdventurers();

        foreach (Adventurer adventurer in adventurers)
        {
            if (adventurer.name == name)
            {
                return(adventurer);
            }
        }

        return(new Adventurer());
    }
Ejemplo n.º 4
0
    void Start()
    {
        // We set up the dropdown containing all the adventurer's names
        // We empty the dropdown
        dropdownAdventurers.ClearOptions();
        // We add all the adventurer's name
        dropdownAdventurers.AddOptions(MGMT_Adventurer.GetAdventurersNames());
        // When the value is changed, we display the corresponding adventurer's UI elements
        dropdownAdventurers.onValueChanged.AddListener(delegate
        {
            SetCurrentAdventurer();
        });


        // We manually add players to the game.
        game = new Game();
        game.players.Add(new Player());
        game.players.Add(new Player("Daenerys", 2, 1));
        game.players.Add(new Player("Cersei", 0, 2));
        game.players.Add(new Player("Adam", 1, 2));
        game.currentPlayer = game.players[0];

        // Not implemented correctly yet...
        SetCurrentAdventurer();
        game.adventurer = MGMT_Xml.GetAdventurers()[0];

        /*
         * do
         * {
         *  foreach (Player player in game.players)
         *  {
         *      Debug.Log(player.pseudonym);
         *  }
         * }
         * while (game.KeepTurning());
         */
    }
Ejemplo n.º 5
0
 /// <summary>
 /// Changes the game's Adventurer and sets all the corresponding UI elements
 /// </summary>
 public void SetCurrentAdventurer()
 {
     game.adventurer = MGMT_Xml.GetAdventurers()[dropdownAdventurers.value];
     UI_adventurer.setAdventurer(game.adventurer);
 }