Exemplo n.º 1
0
    // CARD DRAW METHODS

    // creates a card and returns a new card as a GameObject
    GameObject CreateACardAtPosition(ScriptableObject c, Vector3 position, Vector3 eulerAngles)
    {
        // Instantiate a card depending on its type
        GameObject card;

        if (c.GetType().Name == "BasicCardAsset")
        {
            card = GameObject.Instantiate(GlobalSettings.Instance.BasicCardPrefab, position, Quaternion.Euler(eulerAngles)) as GameObject;
            OneBasicCardManager manager = card.GetComponent <OneBasicCardManager> ();
            manager.cardAsset = (BasicCardAsset)c;
            manager.ReadCardFromAsset();
        }
        else if (c.GetType().Name == "EquipmentCardAsset")
        {
            EquipmentCardAsset temp = (EquipmentCardAsset)c;
            if (temp.Range == null || temp.Range == "")
            {
                card = GameObject.Instantiate(GlobalSettings.Instance.ArmorCardPrefab, position, Quaternion.Euler(eulerAngles)) as GameObject;
            }
            else if (temp.Effect == null || temp.Effect == "")
            {
                if (temp.Range == "+1")
                {
                    card = GameObject.Instantiate(GlobalSettings.Instance.DefensiveMountCardPrefab, position, Quaternion.Euler(eulerAngles)) as GameObject;
                }
                else
                {
                    card = GameObject.Instantiate(GlobalSettings.Instance.OffensiveMountCardPrefab, position, Quaternion.Euler(eulerAngles)) as GameObject;
                }
            }
            else
            {
                card = GameObject.Instantiate(GlobalSettings.Instance.WeaponCardPrefab, position, Quaternion.Euler(eulerAngles)) as GameObject;
            }
            OneEquipmentCardManager manager = card.GetComponent <OneEquipmentCardManager> ();
            manager.cardAsset = temp;
            manager.ReadCardFromAsset();
        }
        else
        {
            card = GameObject.Instantiate(GlobalSettings.Instance.ScrollCardPrefab, position, Quaternion.Euler(eulerAngles)) as GameObject;
            OneScrollCardManager manager = card.GetComponent <OneScrollCardManager> ();
            manager.cardAsset = (ScrollCardAsset)c;
            manager.ReadCardFromAsset();
        }

        /*
         * if (c.MaxHealth > 0)
         * {
         * // this card is a creature card
         * card = GameObject.Instantiate(GlobalSettings.Instance.CreatureCardPrefab, position, Quaternion.Euler(eulerAngles)) as GameObject;
         * }
         * else
         * {
         * // this is a spell: checking for targeted or non-targeted spell
         * if (c.Targets == TargetingOptions.NoTarget)
         * card = GameObject.Instantiate(GlobalSettings.Instance.NoTargetSpellCardPrefab, position, Quaternion.Euler(eulerAngles)) as GameObject;
         * else
         * {
         * card = GameObject.Instantiate(GlobalSettings.Instance.TargetedSpellCardPrefab, position, Quaternion.Euler(eulerAngles)) as GameObject;
         * // pass targeting options to DraggingActions
         * DragSpellOnTarget dragSpell = card.GetComponentInChildren<DragSpellOnTarget>();
         * dragSpell.Targets = c.Targets;
         * }
         *
         * }
         *
         * // apply the look of the card based on the info from CardAsset
         * OneCardManager manager = card.GetComponent<OneCardManager>();
         * manager.cardAsset = c;
         * manager.ReadCardFromAsset(); */

        return(card);
    }