Exemple #1
0
    private static void DrawCard(Vector2 position, BonusCard card)
    {
        Object     obj    = Resources.Load("Prefabs/Card");
        GameObject prefab = Instantiate(obj) as GameObject;

        GameObject canvas = GameObject.Find("Canvas");

        prefab.transform.SetParent(canvas.transform);

        Image image = prefab.GetComponent <Image>();

        image.overrideSprite = CardsGenerator.GetSpriteForBonus(card);

        prefab.transform.position = new Vector3(position.x, position.y, 0);
    }