Exemple #1
0
    public override void OnEndDrag()
    {
        // 1) Check if we are holding a card over the table
        if (DragSuccessful())
        {
            // play this card
            var idHolder = GetComponent <IDHolder>();
            if (idHolder == null)
            {
                idHolder = GetComponentInParent <IDHolder>();
            }

            playerOwner.PlaySpellFromHand(idHolder.UniqueID, -1);
        }
        else
        {
            // Set old sorting order
            whereIsCard.Slot = savedHandSlot;
            if (tag.Contains("Low"))
            {
                whereIsCard.VisualState = VisualStates.LowHand;
            }
            else
            {
                whereIsCard.VisualState = VisualStates.TopHand;
            }
            // Move this card back to its slot position
            HandVisual PlayerHand = playerOwner.PlayerArea.handVisual;

            whereIsCard.BringToHandCards();
            transform.DOLocalMove(initialPosition, 1f);
            transform.DOLocalRotateQuaternion(initialRotation, 1f);
        }
    }
Exemple #2
0
    // this method will be called when the card arrived to hand
    void ChangeLastCardStatusToInHand(GameObject card, WhereIsTheCardOrCreature w)
    {
        if (owner == AreaPosition.Low)
        {
            w.VisualState = VisualStates.LowHand;
        }
        else
        {
            w.VisualState = VisualStates.TopHand;
        }

        // set correct sorting order
        w.BringToHandCards();
        // end command execution for DrawACArdCommand
        Command.CommandExecutionComplete();
    }
    public override void OnEndDrag()
    {
        var target        = GetSelectedGameObject((tag) => tag.IsPlayer() || tag.IsCreature());
        var owner         = tag.GetOwnerFromTag();
        var targetIsValid = Targets.IsTargetValid(owner, target);

        if (targetIsValid)
        {
            targetIsValid = AttackTarget(owner, target);
        }

        if (!targetIsValid)
        {
            whereIsThisCard.VisualState = tempVisualState;
            whereIsThisCard.BringToHandCards();
        }

        base.OnEndDrag();
    }
    public override void OnEndDrag()
    {
        if (DragSuccessful())
        {
            int tablePos = playerOwner.PlayerArea.tableVisual.TablePosForNewCreature(Camera.main.ScreenToWorldPoint(
                                                                                         new Vector3(Input.mousePosition.x, Input.mousePosition.y, transform.position.z - Camera.main.transform.position.z)).x);

            var idHolder = this.GetObjectUniqueID();
            playerOwner.PlayACreatureFromHand(idHolder, tablePos);
        }
        else
        {
            whereIsCard.BringToHandCards();
            whereIsCard.VisualState = _initialVisualState;
            var sequence = DOTween.Sequence();
            sequence.Insert(0f, this.transform.DOMove(_initialPosition, 1f));
            sequence.Insert(0f, this.transform.DORotateQuaternion(_initialRotation, 1f));
            sequence.Play();
        }
    }