コード例 #1
0
    private void CallHeroIcons()                                //places heroes icons in storage
    {
        regimentIcons = currentProgress.heroesOfPlayer;         //access to player's regiments
        Transform parentOfIcons = scrollRect.content.transform; //defines the parent object for all icons

        for (int i = 0; i < regimentIcons.Count; i++)
        {
            CharIcon fighterIcon = Instantiate(iconPrefab, parentOfIcons); //instantiate and return an icon
            fighterIcon.charAttributes = regimentIcons[i];                 //assigns scriptable object to an icon
            fighterIcon.FillIcon();                                        //fills the icon with a sprite and the number of units.
            //data taken from scriptable object
        }
    }
コード例 #2
0
    private void CallHeroIcons()                                // coloca los iconos de los héroes en el almacenamiento
    {
        regimentIcons = currentProgress.heroesOfPlayer;         // acceso a los regimientos del jugador
        Transform parentOfIcons = scrollRect.content.transform; // define el objeto padre para todos los iconos

        for (int i = 0; i < regimentIcons.Count; i++)
        {
            CharIcon fighterIcon = Instantiate(iconPrefab, parentOfIcons); // crear una instancia y devolver un icono
            fighterIcon.charAttributes = regimentIcons[i];                 // asigna un objeto programable a un icono
            fighterIcon.FillIcon();                                        // llena el icono con un sprite y el número de unidades.
            // datos tomados de un objeto programable
        }
    }