Exemplo n.º 1
0
        public void RemoveOpponentCardFromBoardToGraveyard(WorkingCard card)
        {
            Vector3   graveyardPos = OpponentGraveyardObject.transform.position + new Vector3(0.0f, -0.2f, 0.0f);
            BoardUnit boardCard    = OpponentBoardCards.Find(x => x.Card == card);

            if (boardCard != null)
            {
                if (boardCard.Transform != null)
                {
                    boardCard.Transform.localPosition = new Vector3(boardCard.Transform.localPosition.x,
                                                                    boardCard.Transform.localPosition.y, -0.2f);
                }

                OpponentBoardCards.Remove(boardCard);

                boardCard.SetHighlightingEnabled(false);
                boardCard.StopSleepingParticles();
                if (boardCard.GameObject != null)
                {
                    boardCard.GameObject.GetComponent <SortingGroup>().sortingLayerID = SRSortingLayers.BoardCards;
                    Object.Destroy(boardCard.GameObject.GetComponent <BoxCollider2D>());
                }

                Debug.Log("Destroy = " + boardCard.CurrentHp + "_" + boardCard.Card.LibraryCard.Name);
            }
            else if (_aiController.CurrentSpellCard != null && card == _aiController.CurrentSpellCard.WorkingCard)
            {
                _aiController.CurrentSpellCard.SetHighlightingEnabled(false);
                _aiController.CurrentSpellCard.GameObject.GetComponent <SortingGroup>().sortingLayerID = SRSortingLayers.BoardCards;
                Object.Destroy(_aiController.CurrentSpellCard.GameObject.GetComponent <BoxCollider2D>());
                Sequence sequence = DOTween.Sequence();
                sequence.PrependInterval(2.0f);
                sequence.Append(_aiController.CurrentSpellCard.Transform.DOMove(graveyardPos, 0.5f));
                sequence.Append(_aiController.CurrentSpellCard.Transform.DOScale(new Vector2(0.6f, 0.6f), 0.5f));
                sequence.OnComplete(
                    () =>
                {
                    _aiController.CurrentSpellCard = null;
                });
            }
        }
Exemplo n.º 2
0
        public void RemovePlayerCardFromBoardToGraveyard(WorkingCard card)
        {
            BoardUnit boardCard = PlayerBoardCards.Find(x => x.Card == card);

            if (boardCard == null)
            {
                return;
            }

            boardCard.Transform.localPosition = new Vector3(boardCard.Transform.localPosition.x,
                                                            boardCard.Transform.localPosition.y, -0.2f);

            PlayerBoardCards.Remove(boardCard);
            PlayerGraveyardCards.Add(boardCard);

            boardCard.SetHighlightingEnabled(false);
            boardCard.StopSleepingParticles();
            boardCard.GameObject.GetComponent <SortingGroup>().sortingLayerID = SRSortingLayers.BoardCards;

            Object.Destroy(boardCard.GameObject.GetComponent <BoxCollider2D>());
        }