Exemplo n.º 1
0
    private void OnMouseUp()
    {
        // Changing the status of the Card
        Status = ControllerStatus.Inactive;

        InterfaceManager.Instance.DisableArrow();
        InterfaceManager.Instance.IsDragging = false;

        // Checking if it's the turn of the Player
        if (GameManager.Instance.CurrentPlayer == Card.Player)
        {
            // Checking if the Player has enough mana to play the Card
            if (Card.Player.AvailableMana >= Card.CurrentCost)
            {
                switch (Card.GetCardType())
                {
                case CardType.Minion:
                    if (Card.Player.BoardController.SelfBoardContainsPoint(Util.GetWorldMousePosition()))
                    {
                        if (Card.Player.Minions.Count < 7)
                        {
                            Card.Play();
                        }
                    }
                    break;

                case CardType.Weapon:
                    if (Card.Player.BoardController.AllBoardContainsPoint(Util.GetWorldMousePosition()))
                    {
                        Card.Play();
                    }
                    break;

                case CardType.Spell:
                    SpellCard spellCard = Card.As <SpellCard>();

                    if (spellCard.TargetType == TargetType.NoTarget)
                    {
                        if (Card.Player.BoardController.AllBoardContainsPoint(Util.GetWorldMousePosition()))
                        {
                            spellCard.PlayOn(null);
                        }
                    }
                    else
                    {
                        Character target = Util.GetCharacterAtMouse();

                        if (spellCard.CanTarget(target))
                        {
                            spellCard.PlayOn(target);
                        }
                    }
                    break;
                }
            }
            else
            {
                // TODO : Display not enough mana message
            }
        }
    }