Пример #1
0
        public void OnCardPressed(object sender, PressedCard e)
        {
            Console.WriteLine($"Clicked {e.Card}");
            switch (e.Card.State)
            {
            case CardStates.Deploy:
                DeployUnit(e.Card);
                break;

            case CardStates.SetFaceDown:
                SetFaceDown(e.Card);
                break;

            case CardStates.AttackUnit:
                Attacker = Attacker is null ? e.Card : null;
                break;

            case CardStates.AttackPlayer:
                break;

            case CardStates.Activate:
                break;

            case CardStates.None:
                // if attacker is not null, card state is attack unit, (and valid target)
                if (Attacker is not null)
                {
                    AttackUnit(Attacker, e.Card);
                }
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
Пример #2
0
 public void OnPressOffCard()
 {
     if (_cardLogic != null)
     {
         if (isCardPressedOn)
         {
             PressedCard.Invoke(false, this.gameObject);
             isCardPressedOn = false;
         }
     }
 }
Пример #3
0
    public void OnPressCard()
    {
        if (_cardLogic != null)
        {
            //Debug.Log(this._card.CardInfo.CardName);
            // tell player hand to handle graphics related things that arent directly related to this particular card

            if (!isCardPressedOn)
            {
                PressedCard.Invoke(true, this.gameObject);
                _card.CardHighlightImage.color = new Color(1, 0, 0, 1);
                isCardPressedOn = true;
                //_animator.SetTrigger("Pressed");
            }
            else
            {
                OnPressOffCard();
            }
        }
    }