当前位置: 首页>>代码示例>>C#>>正文


C# Card.GetType方法代码示例

本文整理汇总了C#中Card.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# Card.GetType方法的具体用法?C# Card.GetType怎么用?C# Card.GetType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Card的用法示例。


在下文中一共展示了Card.GetType方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: canPlayCard

    public bool canPlayCard(Card card)
    {
        Debug.Log(card.manaCost[1]);
        if (!payMana(card.manaCost))
            return false;

        if (card.GetType() == typeof(UnitCard))
            return (cardsOfType(card) < Math.Max(memory / 2, 1));
        else if (card.GetType() == typeof(SpellCard))
            return (cardsOfType(card) < Math.Max(impulse / 3, 1));
        else if (card.GetType() == typeof(CrystalCard))
        {
            if (crystals.Count < impulse)
                return (cardsOfType(card) < Math.Max(memory, 1));
        }
        //Equipments
        else
            return (cardsOfType(card) < Math.Max(memory / 2, 1));
        return false;
    }
开发者ID:ExaltedBagel,项目名称:TargetPractice,代码行数:20,代码来源:Hero.cs

示例2: PlayCardOnHex

 public override Unit PlayCardOnHex(Card card, Hex hex, string id)
 {
     CardHistory.Add(card);
     GuiControl.AddCardToHistory(card);
     // TODO Clean up this method to better handle multiple card types.
     if(typeof(EntityCard).IsAssignableFrom(card.GetType())) {
         EntityCard eCard = (EntityCard) card;
         GameObject go = (GameObject) Instantiate(UnitPrefab, Vector3.zero, Quaternion.identity);
         Unit unit = go.GetComponent<Unit>();
         unit.Id = id;
         unit.FromCard(eCard);
         unit.Hex = hex;
         unit.transform.position = hex.transform.position;
         hex.Unit = unit;
         Units.Add(unit);
         unit.Team = MyTurn() ? Team.ME : Team.ENEMY;
         if(MyTurn() && ThisPlayer.Hand.Count != 0) {
             // TODO Find a better way to sort this
             ThisPlayer.PlayCard();
         }
         card.OnPlay(new StateObject(Units, hex, null, MyTurn() ? ThisPlayer : EnemyPlayer, MyTurn() ? EnemyPlayer : ThisPlayer));
         return unit;
     } else {
         if(MyTurn() && ThisPlayer.Hand.Count != 0) {
             // TODO Find a better way to sort this
             ThisPlayer.PlayCard();
         }
         card.OnPlay(new StateObject(Units, hex, null, MyTurn() ? ThisPlayer : EnemyPlayer, MyTurn() ? EnemyPlayer : ThisPlayer));
         return null;
     }
 }
开发者ID:AndersHqst,项目名称:Battle-For-Betelgeuse,代码行数:31,代码来源:KingOfTheHill.cs

示例3: ValuateCard

 int ValuateCard(Card card)
 {
     int v = 0;
     if(typeof(UnitCard).IsAssignableFrom(card.GetType())) {
         v = UnitCardValue((UnitCard) card);
     } else if(typeof(BuildingCard).IsAssignableFrom(card.GetType())) {
         // TODO Find a better way of calculating buildingvalues
         v = UnitCardValue((BuildingCard) card);
     } else if(typeof(SpellCard).IsAssignableFrom(card.GetType())) {
         SpellCard sCard = (SpellCard) card;
         player.SetTargetsForCard(card);
         foreach(Hex hex in player.targets) {
             int k = SpellOnHexValue(sCard, hex);
             v = k > v ? k : v;
         }
         player.targets = new List<Hex>();
     }
     return v;
 }
开发者ID:AndersHqst,项目名称:Battle-For-Betelgeuse,代码行数:19,代码来源:EasyAI.cs

示例4: PlayCard

    bool PlayCard(Card card)
    {
        // TODO When adding different card types, improve this.
        // Choose a card
        if(card == null) { return false; }
        if(typeof(SpellCard).IsAssignableFrom(card.GetType())) { return PlaySpellCard((SpellCard) card); }

        // Choose a tile
        Hex targetHex = null;

        player.SetTargetsForCard(card);
        if(player.targets.Count > 1) {
            targetHex = player.targets[Random.Range(0, player.targets.Count-1)];
        } else if(player.targets.Count == 1) {
            targetHex = player.targets[0];
        } else {
            return false;
        }
        // Play card
        gameControl.EnemyCardPlayed(card);
        Unit unit = gameControl.PlayCardOnHex(card, targetHex, System.Guid.NewGuid().ToString());
        player.SpendMana(card.Cost);
        player.Hand.Remove(card);
        unitMoves[unit] = StandardList();
        unitBlacklist[unit] = new List<Hex>();
        return true;
    }
开发者ID:AndersHqst,项目名称:Battle-For-Betelgeuse,代码行数:27,代码来源:EasyAI.cs

示例5: cardsOfType

 private int cardsOfType(Card card)
 {
     int n = 0;
     Debug.Log("Card played is " + card.GetType().ToString());
     foreach (Card x in cardsPlayed)
     {
         Debug.Log("Card already played is " + x.GetType().ToString());
         if (x.GetType() == card.GetType())
             n++;
     }
         
     return n;
 }
开发者ID:ExaltedBagel,项目名称:TargetPractice,代码行数:13,代码来源:Hero.cs

示例6: ValuateCard

 int ValuateCard(Card card)
 {
     int v = int.MinValue;
     if(typeof(EntityCard).IsAssignableFrom(card.GetType())) {
         v = EntityCardValue((EntityCard) card);
     } else if(typeof(SpellCard).IsAssignableFrom(card.GetType())) {
         SpellCard sCard = (SpellCard) card;
         if(!sCard.IsTargetless) {
             player.SetTargetsForCard(card);
             foreach(Hex hex in player.targets) {
                 int k = SpellOnHexValue(sCard, hex);
                 v = Mathf.Max (k, v);
             }
             player.targets = new List<Hex>();
         } else {
             v = sCard.TargetlessMockOnPlay();
         }
     }
     return v;
 }
开发者ID:AndersHqst,项目名称:Battle-For-Betelgeuse,代码行数:20,代码来源:HardAI.cs

示例7: PlayCard

 bool PlayCard(Card card)
 {
     if(card == null) { return false; }
     if(typeof(SpellCard).IsAssignableFrom(card.GetType())) { return PlaySpellCard((SpellCard) card); }
     if(typeof(EntityCard).IsAssignableFrom(card.GetType())) { return PlayEntityCard((EntityCard) card); }
     return false;
 }
开发者ID:AndersHqst,项目名称:Battle-For-Betelgeuse,代码行数:7,代码来源:HardAI.cs


注:本文中的Card.GetType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。