Exemplo n.º 1
0
 public void Initialize(Deck.CardDef _def, Tile startingTile, bool _enemy)
 {
     board = FindObjectOfType <Board>();
     //illuminated = new List<Tile>();
     def   = _def;
     enemy = _enemy;
     MoveTo(startingTile);
     curLife = def.life;
     obj     = FindObjectOfType <Objective>();
     sr      = GetComponent <SpriteRenderer>();
     if (enemy)
     {
         sr.color = Color.red;
     }
     traits = new List <Trait>();
     if (def.description.Contains("Taunt"))
     {
         traits.Add(Trait.TAUNT);
     }
     if (def.description.Contains("Charge"))
     {
         traits.Add(Trait.CHARGE);
     }
     if (def.description.Contains("Poison"))
     {
         traits.Add(Trait.POISON);
     }
     if (traits.Contains(Trait.CHARGE))
     {
         remainingMovement = def.movement;
         canAttack         = true;
     }
     taunters = new List <Unit>();
 }
Exemplo n.º 2
0
 public void Draw()
 {
     if (cards.Count >= maxHandSize)
     {
         return;
     }
     Deck.CardDef cardDef = deck.Draw();
     if (cardDef != null)
     {
         Card card = ((GameObject)(Instantiate(Resources.Load("Card")))).GetComponent <Card>();
         card.Initialize(cardDef, enemy, this);
         cards.Add(card);
     }
     UpdateCards();
 }
Exemplo n.º 3
0
 public void Initialize(Deck.CardDef _def, bool _enemy, Hand _hand, bool _showcase = false)
 {
     def   = _def;
     enemy = _enemy;
     cam   = Camera.main;
     transform.position = cam.transform.position - (Vector3)startOffset;
     targetPos          = transform.position;
     targetRotation     = transform.rotation.eulerAngles.z;
     hand        = _hand;
     showcase    = _showcase;
     board       = FindObjectOfType <Board>();
     mana        = GameObject.Find("PlayerMana").GetComponent <Counter>();
     description = transform.GetChild(0).GetComponent <Text>();
     visual      = transform.GetChild(1).GetComponent <Image>();
     cost        = transform.GetChild(2).GetComponent <Text>();
     life        = transform.GetChild(3).GetComponent <Text>();
     attack      = transform.GetChild(4).GetComponent <Text>();
     movement    = transform.GetChild(5).GetComponent <Text>();
     range       = transform.GetChild(6).GetComponent <Text>();
     name        = transform.GetChild(7).GetComponent <Text>();
     if (enemy)
     {
         description.enabled = false;
         visual.enabled      = false;
         cost.enabled        = false;
         life.enabled        = false;
         attack.enabled      = false;
         movement.enabled    = false;
         range.enabled       = false;
         name.enabled        = false;
     }
     else
     {
         description.text = "" + def.description;
         //visual.sprite = Resources.Load(def.visual) as Sprite;
         cost.text     = "" + def.cost;
         life.text     = "" + def.life;
         attack.text   = "" + def.attack;
         movement.text = "" + def.movement;
         range.text    = "" + def.range;
         name.text     = "" + def.name;
     }
 }
Exemplo n.º 4
0
 // Update is called once per frame
 void Update()
 {
     //if less than 5 cards, draw
     while (cards.Count < 5)
     {
         Deck.CardDef cardDef = deck.Draw();
         if (cardDef == null) //stop when no cards in deck
         {
             break;
         }
         //make card object
         Card card = ((GameObject)(GameObject.Instantiate(Resources.Load("Card")))).GetComponent <Card>();
         cards.Add(card);
     }
     for (int i = 0; i < cards.Count; i++)
     {
         Card card = cards[i];
         //Vector2 targetPos = GetTargetPos(i, cards.Count);
         //card.targetPos = targetPos;
         UpdateCard(card, i, cards.Count);
     }
 }