public void PutCard(DeckTag putDeck, int playerCardIndex, bool isBack = false, float reverseTime = 0.5f) { var deck = DeckSystem.GetInstance().GetDeck(putDeck); var putCardIdx = PlayerCard[playerCardIndex].GetCardIndex(); var putShapeIdx = PlayerCard[playerCardIndex].GetShapeIndex(); PlayerCard[playerCardIndex].transform.DOMove(deck.GetPosition(), 0.5f); PlayerCard[playerCardIndex].transform.DORotate(deck.GetAngle(), 0.5f); if (isBack) { CardAnimationSystem.GetInstance().ReverseAnimation( PlayerCard[playerCardIndex], reverseTime); } deck.AddCard(PlayerCard[playerCardIndex]); ////////////////////////////////////// /// TODO : 커플링으로 인해 분리해야함 RuleSystem.GetInstance().AddAttackCardDamage(putCardIdx, putShapeIdx); AlertSystem.GetInstance().AddAlerts(putCardIdx, putShapeIdx); ////////////////////////////////////// IsPutCard = true; PlayerCard.RemoveAt(playerCardIndex); RePosition(); NetworkSystem.GetInstance().SendServer(string.Format("PUT-CARD:{0}:{1}", PlayerId, playerCardIndex)); }
/// <summary>해당 id를 가진 플레이어에게 카드 추가 </summary> /// <param name="deckTag">카드를 가져올 덱</param> /// <param name="playerName">플레이어 이름</param> /// <param name="cardNum">카드 갯수</param> public void PlayerAddCardWithDeck(DeckTag deckTag, string playerId, int cardNum) { Observable.Interval(TimeSpan.FromSeconds(0.05f)) .Take(cardNum) .Subscribe(_ => { var player = Players.Find(p => p.PlayerId == playerId); if (player == null) { Debug.Log("Player not found : " + playerId); return; } var card = DeckSystem.GetInstance().GetTopCardWithDeck(deckTag); if (card == null) { return; } if (player.PlayerId == MyPlayerId) { CardAnimationSystem.GetInstance().ReverseAnimation(card, 0.5f); } player.AddPlayerCard(card); }); }
public void AllCardReverse(float time) { for (int i = 0; i < PlayerCard.Count; i++) { CardAnimationSystem.GetInstance().ReverseAnimation(PlayerCard[i], time); } }
public void AllMoveCardDecktoDeck(Deck moveDeck, float intervalTime, float moveTime, Action complete = null) { Observable.Interval(TimeSpan.FromSeconds(intervalTime)) .Take(DeckList.Count) .Subscribe(_ => { int i = (int)_; DeckList[i].SetSortingOrder(i); DeckList[i].ObjTransform.DOMove(moveDeck.GetPosition(), moveTime); CardAnimationSystem.GetInstance().ReverseAnimation( DeckList[i], moveTime); moveDeck.AddCard(DeckList[i]); }, () => { DeckList.Clear(); if (complete != null) { complete(); } }); }
public void MoveCardDecktoDeck(Deck moveDeck, int startCardIdx, int cardNum, float intervalTime, float moveTime, Action complete = null) { Observable.Interval(TimeSpan.FromSeconds(intervalTime)) .Take(cardNum) .Subscribe(i => { int idx = startCardIdx; moveDeck.AddCard(DeckList[idx]); DeckList[idx].transform.DOMove(moveDeck.GetPosition(), moveTime); CardAnimationSystem.GetInstance().ReverseAnimation( DeckList[idx], moveTime); DeckList.RemoveAt(idx); }, () => { for (int i = 0; i < DeckList.Count; i++) { DeckList[i].SetSortingOrder(i); } if (complete != null) { complete(); } }); }
public IEnumerator AllCardReverse() { for (int i = 0; i < Cards.Count; i++) { CardAnimationSystem.GetInstance().ReverseAnimation(Cards[i], 3); } yield return(null); }
public void MoveCardDecktoDeck(Deck moveDeck, int cardNum, float intervalTime, float moveTime) { Observable.Interval(TimeSpan.FromSeconds(intervalTime)) .Take(cardNum) .Subscribe(_ => { moveDeck.AddCard(DeckList[DeckList.Count - 1]); DeckList[DeckList.Count - 1].transform.DOMove(moveDeck.GetPosition(), moveTime); CardAnimationSystem.GetInstance().ReverseAnimation( DeckList[DeckList.Count - 1], moveTime); DeckList.RemoveAt(DeckList.Count - 1); }); }