Пример #1
0
 public void onMouseLeave(GOWithScript <CardManager> card)
 {
     if (isEnabled)
     {
         phaseManager.onMouseLeave(card);
     }
 }
Пример #2
0
        private void lookForACardTarget(GOWithScript <CardManager> card)
        {
            Ray ray = GameController.Instance.MainCamera.ScreenPointToRay(Input.mousePosition);
            var hit = Physics2D.Raycast(ray.origin, ray.direction);

            if (hit.transform != null)
            {
                if (hit.transform.CompareTag("Enemy") && !card.script.getCard().isFriendly&& card.script.getCard().cardType == Card.CardType.Spell)
                {
                    target = hit.transform.gameObject;
                }
                else if (hit.transform.CompareTag("Creature") && card.script.getCard().isFriendly&& card.script.getCard().cardType == Card.CardType.Spell)
                {
                    target = hit.transform.gameObject;
                }
                else if (hit.transform.CompareTag("Tile") && card.script.getCard().cardType == Card.CardType.Creature)
                {
                    target = hit.transform.gameObject;
                }
                else
                {
                    target = null;
                }
            }
            else
            {
                target = null;
            }
        }
Пример #3
0
 public void onCardReleasedWhileHoverOver(GOWithScript <CardManager> card)
 {
     if (isEnabled)
     {
         phaseManager.onCardReleasedWhileHoverOver(card);
     }
 }
Пример #4
0
 public void onCardReleased(GOWithScript <CardManager> card)
 {
     if (isEnabled)
     {
         phaseManager.onCardReleased(card);
     }
 }
Пример #5
0
        public void onMouseEnter(GOWithScript <CardManager> card)
        {
            var size = card.script.BoxCollider.size;

            size = new Vector3(size.x / 2f, size.y, size.z);
            card.script.BoxCollider.size = size;

            if (isCardHeld && card.gameObject != heldCard.gameObject)
            {
                return;
            }

            var thisTransform = card.gameObject.transform;

            if (targetingLine < Input.mousePosition.y)
            {
                return;
            }

            thisTransform.forceScaleSafe(zoomedInScale);
            thisTransform.rotation = Quaternion.identity;

            thisTransform.SetAsLastSibling();

            thisTransform.forcePositionSafe(new Vector3(thisTransform.position.x, pickupYOffset - 5, thisTransform.position.z));
        }
Пример #6
0
        private void tryEnqueueCard(GOWithScript <CardManager> card)
        {
            card.gameObject.transform.localRotation = Quaternion.identity;
            lookForACardTarget(card);

            //check if the card is still in the lower part of the screen and only play it if it is not
            if (Input.mousePosition.y < targetingLine)
            {
                card.gameObject.transform.scaleTo(0.2f, HandManager.instance.originalCardScale);
                EasyDelayManager.instance.ExecuteAfter(0.3f, () => {
                    card.gameObject.layer = LayerMask.NameToLayer(HandManager.uiLayerName);
                });
                return;
            }

            Card c = heldCard.script.getCard();

            if (c.checkIfPlayable() && target != null)
            {
                enqueuePlaying(c);
            }
            else
            {
                showUnableToPlayMessage(c);
                card.gameObject.transform.scaleTo(0.05f, HandManager.instance.originalCardScale);
                card.gameObject.layer = LayerMask.NameToLayer(HandManager.uiLayerName);
            }
        }
Пример #7
0
        public void addCard(GameObject card)
        {
            var cardObject = new GOWithScript <CardManager>(card, card.GetComponent <CardManager>());

            if (cardObject.script != null)
            {
                phaseManager.addCard(cardObject);
            }
            else
            {
                Debug.LogError("could not add game object to hand, CardManager not found");
            }
        }
Пример #8
0
        public void onCardClicked(GOWithScript <CardManager> card)
        {
            //CursorManager.hide();

            target = null;
            HandManager.instance.CardTypeHeld = card.script.getCard().cardType;

            heldCard = card;
            heldCard.gameObject.layer = LayerMask.NameToLayer(HandManager.ignoreRaycastLayerName);

            createParticles();

            TooltipController.Instance.ShowTooltips = false;
        }
Пример #9
0
        public void onMouseLeave(GOWithScript <CardManager> card)
        {
            var size = card.script.BoxCollider.size;

            size = new Vector3(size.x * 2f, size.y, size.z);
            card.script.BoxCollider.size = size;

            if (isCardHeld && card.gameObject == heldCard.gameObject)
            {
                return;
            }

            card.gameObject.transform.forceScaleSafe(HandManager.instance.originalCardScale);
            fitCards(null, card.gameObject);
        }
Пример #10
0
        public void onCardReleased(GOWithScript <CardManager> card)
        {
            //CursorManager.show();

            HandManager.instance.CardTypeHeld = null;

            if (!isCardHeld)
            {
                Debug.LogWarning("Released card was invalid!");
                return;
            }

            tryEnqueueCard(card);
            fitCards();
            isCardHeld = false;

            TooltipController.Instance.ShowTooltips = true;
        }
Пример #11
0
        public void addCard(GOWithScript <CardManager> card)
        {
            if (CombatController.Instance.IsFightOver)
            {
                return;
            }

            if (cards.Count >= HandManager.MaxHandSize)
            {
                DialogueController.Instance.ShowMessage("You can only have up to " + HandManager.MaxHandSize +
                                                        " cards in your hand!");
                removeCard(card.gameObject, false);
                return;
            }

            cards.Add(card);
            card.gameObject.layer = LayerMask.NameToLayer(HandManager.uiLayerName);

            fitCards();
        }
 public void onCardReleasedWhileHoverOver(GOWithScript <CardManager> card)
 {
     CombatController.Instance.AddCardToRunDeck(card.script.getCard());
     this.clear();
     HandManager.instance.CardPicker.parent.gameObject.SetActive(false);
 }
 public void onCardReleased(GOWithScript <CardManager> card)
 {
 }
 public void onCardClicked(GOWithScript <CardManager> card)
 {
     card.gameObject.transform.forceScaleSafe(zoomedInScale * 1.1f);
 }
 public void addCard(GOWithScript <CardManager> card)
 {
     offeredCardObjects.Add(card);
 }
Пример #16
0
 public PhaseManagerPlaying()
 {
     heldCard   = new GOWithScript <CardManager>(null, null);
     isCardHeld = false;
 }
Пример #17
0
 public void onCardReleasedWhileHoverOver(GOWithScript <CardManager> card)
 {
 }
        public void onMouseEnter(GOWithScript <CardManager> card)
        {
            var thisTransform = card.gameObject.transform;

            thisTransform.forceScaleSafe(zoomedInScale);
        }
 public void onMouseLeave(GOWithScript <CardManager> card)
 {
     card.gameObject.transform.forceScaleSafe(nonZoomedInScale);
 }
Пример #20
0
 public void addCard(GOWithScript <CardManager> card)
 {
     phaseManager.addCard(card);
 }