コード例 #1
0
    internal void PreviewModel(AvatarModel heroModel, AvatarModel target, bool friendly)
    {
        Card c = target != null ? target.Card : null;

        Prepare(heroModel, c, global::WhereAmI.Board);

        //on board there is no color
        ImageColor.SetActive(false);
        PanelAttack.GetComponent <PanelValue>().Prepare(target != null ? target.ActualAttack:0);
        PanelHealth.GetComponent <PanelValue>().Prepare(target != null ? target.ActualHealth:0);
        PanelArmor.GetComponent <PanelValue>().Prepare(target != null ? target.Armor : 0);

        ImageBorder.SetActive(target != null);
        if (target != null)
        {
            ImageBorder.GetComponent <Image>().color    = target.MovesLeft > 0 ? Color.green : Color.black;
            ImageBorder.GetComponent <Image>().material = Image.defaultGraphicMaterial;

            if (!friendly)
            {
                ImageBorder.GetComponent <Image>().color    = Color.red;
                ImageBorder.GetComponent <Image>().material = SpriteManager.Font.material;
            }
        }
        bool hasTaunt  = false;
        bool hasSticky = false;

        if (target != null)
        {
            foreach (CastedCard cc in target.Effects)
            {
                if (cc.Params.ContainsKey(CastedCardParamType.Taunt))
                {
                    hasTaunt = true;
                }
            }

            foreach (KeyValuePair <Side, AvatarModel> kvp in target.AdjacentModels)
            {
                if (kvp.Value != null)
                {
                    foreach (CastedCard cc in kvp.Value.Effects)
                    {
                        if (cc.Params.ContainsKey(CastedCardParamType.Sticky))
                        {
                            hasSticky = true;
                        }
                    }
                }
            }
        }
        ImageTaunt.SetActive(hasTaunt);
        ImageSticky.SetActive(hasSticky);
    }
コード例 #2
0
    public void Prepare(AvatarModel heroModel, Card card, WhereAmI whereAmI)
    {
        HeroModel = heroModel;
        Card      = card;

        CardImage.SetActive(Card != null);
        ImageColor.SetActive(Card != null);
        ImageOval.SetActive(Card != null);
        PanelCrystal.SetActive(Card != null);
        PanelAttack.SetActive(Card != null);
        PanelHealth.SetActive(Card != null);
        ImageTaunt.SetActive(false);
        ImageSticky.SetActive(false);
        //minion has green background
        ImageColor.GetComponent <Image>().color = (card != null && card.CardPersistency.IsCharacter()) ? Color.blue : Color.red;
        //minion has oval
        //ImageOval.SetActive(card!=null && Card.CardPersistency.IsCharacter());

        CardImage.GetComponent <Image>().sprite = card != null?card.Animation:null;

        ImageBorder.SetActive(whereAmI == global::WhereAmI.Hand || whereAmI == global::WhereAmI.SpecialPower || whereAmI == global::WhereAmI.Board);
    }