Example #1
0
    private bool Check(out Hero _attacker, out Hero _defender)
    {
        if (string.IsNullOrEmpty(attackerID.text) || string.IsNullOrEmpty(attackerPower.text) || string.IsNullOrEmpty(attackerHp.text) || string.IsNullOrEmpty(defenderID.text) || string.IsNullOrEmpty(defenderPower.text))
        {
            _attacker = _defender = null;

            return(false);
        }
        else
        {
            HeroSDS attackerSDS = StaticData.GetData <HeroSDS>(int.Parse(attackerID.text));

            _attacker = new Hero(true, attackerSDS, 0, int.Parse(attackerHp.text), int.Parse(attackerPower.text));

            HeroSDS defenderSDS = StaticData.GetData <HeroSDS>(int.Parse(defenderID.text));

            _defender = new Hero(false, defenderSDS, 0, defenderSDS.hp, int.Parse(defenderPower.text));

            if (isDefense.isOn)
            {
                _defender.SetAction(Hero.HeroAction.DEFENSE);
            }

            return(true);
        }
    }
Example #2
0
    protected void InitCard(HeroSDS _heroSDS)
    {
        sds = _heroSDS;

        nameText.text = sds.name;

        if (!sds.canControl)
        {
            nameText.color = Color.red;
        }
    }
Example #3
0
    public void Init(int _id)
    {
        HeroSDS heroSDS = StaticData.GetData <HeroSDS> (_id);

        InitCard(heroSDS);

        hp.gameObject.SetActive(false);

        power.gameObject.SetActive(false);

        SetBodyColor();
    }
Example #4
0
    public void Init(int _cardUid, int _id)
    {
        cardUid = _cardUid;

        HeroSDS heroSDS = StaticData.GetData <HeroSDS> (_id);

        InitCard(heroSDS);

        cost.text = sds.cost.ToString();

        SetBodyColor();
    }
Example #5
0
    public void Init(int _id, int _hp, int _power)
    {
        cardUid = -1;

        sds = StaticData.GetData <HeroSDS> (_id);

        heroType.text = sds.heroTypeSDS.name;

        damage.text = sds.damage.ToString();

        hp.text = _hp.ToString();

        power.text = _power.ToString();
    }
    private int GetMoney()
    {
        int money = battle.clientIsMine ? battle.mMoney : battle.oMoney;

        Dictionary <int, int> cards = battle.clientIsMine ? battle.mHandCards : battle.oHandCards;

        Dictionary <int, int> .KeyCollection.Enumerator enumerator = battle.summon.Keys.GetEnumerator();

        while (enumerator.MoveNext())
        {
            int cardID = cards[enumerator.Current];

            HeroSDS heroSDS = StaticData.GetData <HeroSDS>(cardID);

            money -= heroSDS.cost;
        }

        return(money);
    }
    private HeroBattle AddCardToMap(int _cardUid, int _pos)
    {
        int cardID = (battle.clientIsMine ? battle.mHandCards : battle.oHandCards) [_cardUid];

        GameObject go = GameObject.Instantiate <GameObject>(Resources.Load <GameObject>("HeroBattle"));

        HeroBattle hero = go.GetComponent <HeroBattle>();

        summonHeroDic.Add(_pos, hero);

        HeroSDS sds = StaticData.GetData <HeroSDS> (cardID);

        hero.Init(cardID);

        hero.cardUid = _cardUid;

        AddHeroToMapReal(hero, _pos);

        return(hero);
    }