Exemplo n.º 1
0
        public override bool IsComplete()
        {
            PlayerHolder p = Settings.gameManager.currentPlayer;
            PlayerHolder e = Settings.gameManager.GetEnemyOf(p);

            if (p.atackingCards.Count == 0)
            {
                return(true);
            }
            for (int i = 0; i < p.atackingCards.Count; i++)
            {
                CardInstance   inst   = p.atackingCards[i];
                Card           c      = inst.viz.card;
                CardProperties attack = c.GetProperty(attackElement);
                if (attack == null)
                {
                    Debug.Log("You are attacking with a card that cannot attack");
                    continue;
                }
                p.DropCard(inst, false);
                p.currentHolder.SetCardDown(inst);
                inst.SetTapped();

                e.DoDamage(attack.intValue);
            }
            p.atackingCards.Clear();
            return(true);
        }
Exemplo n.º 2
0
        public void SetCardOnBattleLine(CardInstance card)
        {
            Vector3 position = card.viz.gameObject.transform.position;

            Settings.SetParentForCard(card.viz.gameObject.transform, battleLine.value.transform);
            position.z = card.viz.gameObject.transform.position.z;
            position.y = card.viz.gameObject.transform.position.y;
            card.viz.gameObject.transform.position = position;
        }
Exemplo n.º 3
0
 public static void DropCreatureCard(Transform c, Transform p, CardInstance cardInstance)
 {
     cardInstance.isTapped = true;
     //Execute special card abilties on Drop;
     SetParentForCard(c, p);
     cardInstance.SetTapped();
     gameManager.currentPlayer.UseResourceCards(cardInstance.viz.card.cost);
     gameManager.currentPlayer.DropCard(cardInstance);
 }
Exemplo n.º 4
0
 public bool TypeAllowsForAttack(CardInstance cardInstance)
 {
     if (canAttack)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Exemplo n.º 5
0
        public void DropCard(CardInstance inst, bool registerEvent = true)
        {
            if (handCards.Contains(inst))
            {
                handCards.Remove(inst);
            }
            cardsDown.Add(inst);


            if (registerEvent)
            {
                Settings.RegisterEvent("Dropped card for player " + username + " using " + inst.viz.card.cost + " mana", Color.blue);
            }
        }
Exemplo n.º 6
0
        void CreateStartingCards()
        {
            ResourcesManager rm = Settings.GetResourcesManager();

            for (int j = 0; j < allPlayers.Length; j++)
            {
                for (int i = 0; i < allPlayers[j].startingCards.Length; i++)
                {
                    GameObject go      = Instantiate(cardPrefab) as GameObject;
                    CardViz    cardViz = go.GetComponent <CardViz>();
                    cardViz.LoadCard(rm.GetCardInstance(allPlayers[j].startingCards[i]));
                    CardInstance inst = go.GetComponent <CardInstance>();
                    inst.currentLogic = allPlayers[j].handLogic;
                    Settings.SetParentForCard(go.transform, allPlayers[j].currentHolder.handGrid.value.transform);
                    allPlayers[j].handCards.Add(inst);
                }

                allPlayers[j].currentHolder.LoadPlayer(allPlayers[j], allPlayers[j].statsUI);

                Settings.RegisterEvent("Created cards for player" + allPlayers[j].username, Color.white);
            }
        }
Exemplo n.º 7
0
        public override void Execute(float d)
        {
            if (Input.GetMouseButtonDown(0))
            {
                List <RaycastResult> results = Settings.GetUIObjects();

                foreach (RaycastResult r in results)
                {
                    CardInstance inst = r.gameObject.GetComponentInParent <CardInstance>();
                    PlayerHolder p    = Settings.gameManager.currentPlayer;

                    if (!p.cardsDown.Contains(inst))
                    {
                        return;
                    }
                    if (inst.CanAttack())
                    {
                        p.atackingCards.Add(inst);
                        p.currentHolder.SetCardOnBattleLine(inst);
                    }
                }
            }
        }
Exemplo n.º 8
0
 public void SetCardDown(CardInstance card)
 {
     Settings.SetParentForCard(card.viz.gameObject.transform, downGrid.value.transform);
 }
Exemplo n.º 9
0
 public void Set(CardInstance v)
 {
     value = v;
 }