Ejemplo n.º 1
0
    public Deck(DeckSkin skin)
    {
        Sprite[] cardSprites = skin == null ? null : skin.CreateSprites();

        for (int suite = 0; suite < (int)Suite.Count; ++suite)
        {
            for (int type = 0; type < (int)CardType.Count; ++type)
            {
                cards.Add(new Card(skin != null ? cardSprites[type + suite * (int)CardType.Count] : null, (Suite)suite, (CardType)type));
            }
        }
    }
Ejemplo n.º 2
0
    static void CreateDeck()
    {
        DeckSkin deck = ScriptableObject.CreateInstance <DeckSkin>();

        string path = AssetDatabase.GetAssetPath(Selection.activeObject);

        if (path == "")
        {
        }
        else if (Path.GetExtension(path) != "")
        {
            path = path.Replace(Path.GetFileName(AssetDatabase.GetAssetPath(Selection.activeObject)), "");
        }

        string assetPathAndName = AssetDatabase.GenerateUniqueAssetPath(path + "/New Deck.asset");

        AssetDatabase.CreateAsset(deck, assetPathAndName);
        AssetDatabase.SaveAssets();
        EditorUtility.FocusProjectWindow();
        Selection.activeObject = deck;
    }