Exemple #1
0
    public void Execute(Action Caller)
    {
        ChampionCard card = (ChampionCard)Caller.CallerCard;

        //resize card
        card.Shrink();

        Lane targetLane = GameWorld.Instance.Lanes.Find(x => x.name == Caller.Target);

        if (null != targetLane)
        {
            targetLane.AddCard(card, card.Owner.Side);
        }
    }
Exemple #2
0
    void SetCardUI(Card currCard, ChampionCard champ, int index)
    {
        currCard.gameObject.SetActive(true);

        currCard.SetImage(champ.image);
        currCard.SetName(champ.championName);
        currCard.SetTraits(champ.traits);
        currCard.SetCost(champ.cost);
        currCard.SetIndexInDeck(index);

        if (useCardGlow)
        {
            if (IsChoiceCorrect(currCard))
            {
                bool setGlow = false;
                for (int i = 0; i < cardsThatHaveBeenClickedOn.Count; i++)
                {
                    // if this card was already selected
                    if (cardsThatHaveBeenClickedOn[i].Equals(currCard.GetName()))
                    {
                        currCard.SetGlow(true);
                        setGlow = true;
                        break;
                    }
                }
                if (!setGlow)
                {
                    currCard.SetGlow(false);
                }
            }
            else
            {
                currCard.SetGlow(false);
            }
        }
    }
Exemple #3
0
    public Card GetChampionCardById(int id)
    {
        ChampionDto champion = null;

        foreach (ChampionDto cdto in GameWorld.Instance.Champions.Data)
        {
            if (cdto.Id == id)
            {
                champion = cdto;
                break;
            }
        }

        if (null == champion)
        {
            return(null);
        }

        GameObject cardObject = new GameObject();

        cardObject.name = champion.Name;

        GameObject cardArtObject = GameObject.CreatePrimitive(PrimitiveType.Quad);

        cardArtObject.name = "Card Mesh";

        //a mesh collider is created by CreatePrimitive(). We don't need it
        Destroy(cardArtObject.GetComponent <MeshCollider>());

        cardArtObject.transform.SetParent(cardObject.transform, false);

        cardArtObject.GetComponent <Renderer>().material = new Material(Shader.Find("Unlit/Texture"));

        ChampionCard card = cardObject.AddComponent <ChampionCard>();

        card.championData      = champion;
        card.cardMesh          = cardArtObject;
        card.onPlayActionChain = championActionChain;
        card.cardName          = champion.Name;

        BoxCollider boxCollider = cardObject.AddComponent <BoxCollider>();

        boxCollider.size = new Vector3(1, 1, 0.1f);

        Texture2D texture;

        if (championMediumTextures.TryGetValue(champion.Id, out texture))
        {
            card.image = texture;
            card.thumb = championSmallTextures[champion.Id];
        }
        else
        {
            texture      = new Texture2D(8, 8);
            texture.name = string.Format("{0}_image", champion.Name);
            championMediumTextures[champion.Id] = texture;
            card.image = texture;

            StartCoroutine(DownloadImage(string.Format(Constants.championMediumImageUrl, champion.Key, "0"), texture));

            texture      = new Texture2D(8, 8);
            texture.name = string.Format("{0}_thumb", champion.Name);
            championSmallTextures[champion.Id] = texture;
            card.thumb = texture;

            StartCoroutine(DownloadImage(string.Format(Constants.championSmallImageUrl, GameWorld.Instance.DragonDataVersion, champion.Key), texture));
        }

        card.Init();
        return(card);
    }