Пример #1
0
        IEnumerator LoadAnimation()
        {
            Sprite[] sprites = assetPacker.GetSprites("walking");

            int j = 0;

            while (j < sprites.Length)
            {
                anim.sprite = sprites[j++];

                yield return(new WaitForSeconds(0.1f));

                if (j == sprites.Length)
                {
                    j = 0;
                }
            }
        }
Пример #2
0
    void OnTexturePackingComplete()
    {
        // Transfer sprites over to skin to hold
        Dictionary <string, Sprite[]> packedSprites = new Dictionary <string, Sprite[]>();

        foreach (var imageInfo in imagesToPack)
        {
            Sprite[] sprites = assetPacker.GetSprites(imageInfo.Key);
            if (sprites.Length > 0)
            {
                // Asset packer returns sprites via prefix. GHL specific assets have a "_ghl" suffix. Will cause ghl assets to get mixed with normal ones. Need to fix.
                {
                    const string GHL_ID = "_ghl";
                    if (!imageInfo.Key.Contains(GHL_ID))
                    {
                        List <Sprite> spriteList = new List <Sprite>();
                        spriteList.AddRange(sprites);

                        for (int i = spriteList.Count - 1; i >= 0; --i)
                        {
                            if (spriteList[i].name.Contains(GHL_ID))
                            {
                                spriteList.RemoveAt(i);
                            }
                        }

                        sprites = spriteList.ToArray();
                    }
                }

                packedSprites.Add(imageInfo.Key, sprites);
            }
        }

        progressText.text = "Loading Complete!";

        StartCoroutine(LoadEditor(packedSprites));
    }