示例#1
0
        /// <summary>
        /// Drop Creature Card On Field.
        /// Navigate Card Instance to appropriate logics.
        /// </summary>
        /// <param name="logic"></param>
        /// <param name="target"></param>
        private bool DropAfterDrag(PhaseId logic, Card target)
        {
            SpellCard       spell           = null;
            CreatureCard    creature        = null;
            CardLogic       cardLogic       = new CardLogic();
            CardSyncManager cardPlayManager = CardSyncManager.singleton;
            bool            ret             = false;

            if (target is SpellCard)
            {
                spell = (SpellCard)target;
            }
            else if (target is CreatureCard)
            {
                creature = (CreatureCard)target;
            }

            if (logic == PhaseId.Control)
            {
                if (spell)
                {
                    cardLogic.UseSpell(spell);
                }
                else if (creature)
                {
                    ret = cardLogic.DropCard(creature);
                    if (ret)
                    {
                        Area a = target.PhysicalCondition.GetOriginFieldLocation().GetComponent <Area>();
                        cardPlayManager.CardPlayDrop(creature, a);
                    }
                }
            }
            else if (logic == PhaseId.Block)
            {
                ret = cardLogic.BlockCard(creature);
                if (ret)
                {
                    CreatureCard atkCard = cardLogic.GetAttackingCard;
                    cardPlayManager.CardPlayBlock(creature, atkCard);
                }
            }

            return(ret);
        }