Exemplo n.º 1
0
    private void Start()
    {
        logo = new LayeredColoredSprite(3);
        logoDisplay.DisplayLayeredColoredSprite(logo);
        layer1Sprites = SpriteLoader.GetAllSymbolParts("Back");
        layer2Sprites = SpriteLoader.GetAllSymbolParts("Mid");
        layer3Sprites = SpriteLoader.GetAllSymbolParts("Front");

        layer1Index = UnityEngine.Random.Range(0, layer1Sprites.Count - 1);
        layer2Index = UnityEngine.Random.Range(0, layer2Sprites.Count - 1);
        layer3Index = UnityEngine.Random.Range(0, layer3Sprites.Count - 1);
        color1Index = UnityEngine.Random.Range(0, layerColors.Count - 1);
        color2Index = UnityEngine.Random.Range(0, layerColors.Count - 1);
        color3Index = UnityEngine.Random.Range(0, layerColors.Count - 1);

        CycleLayer(1);
        CycleLayer(2);
        CycleLayer(3);
        CycleColor(1);
        CycleColor(2);
        CycleColor(3);
    }
Exemplo n.º 2
0
    public static LayeredColoredSprite[] GenerateLayeredSprites(List <string> layerNames, List <Color> layerColors, int number = 1)
    {
        List <List <Sprite> > spriteLayers = new List <List <Sprite> >();

        foreach (string s in layerNames)
        {
            List <Sprite> sprites = SpriteLoader.GetAllSymbolParts(s);
            if (sprites != null && sprites.Count > 0)
            {
                spriteLayers.Add(sprites);
            }
        }
        LayeredColoredSprite[] toReturn = new LayeredColoredSprite[number];
        for (int i = 0; i < number; i++)
        {
            toReturn[i] = new LayeredColoredSprite(spriteLayers.Count);
            for (int j = 0; j < spriteLayers.Count; j++)
            {
                toReturn[i].SetSprite(j, spriteLayers[j][Random.Range(0, spriteLayers[j].Count)]);
                toReturn[i].SetColor(j, layerColors[Random.Range(0, layerColors.Count)]);
            }
        }
        return(toReturn);
    }