public void ReverseAnimation(Card card, float time) { card.ObjTransform.DOScaleX(0, time / 2).SetEase(Ease.Linear) .OnComplete(() => { card.IsShapesActive(); card.IsTextsActive(); card.IsBack = !card.IsBack; card.SetBackgroundSprite(CardSystem.GetInstance().GetCardSprite(card.IsBack)); card.ObjTransform.DOScaleX(1, time / 2).SetEase(Ease.Linear); }); }
//public IEnumerator ReverseAnimation(Card card, float speed) //{ // float time = 0; // bool isReverseAnim = false; // // Vector3 cardScale = card.GetScale(); // Vector3 startScale = cardScale; // Vector3 destScale = new Vector3(-cardScale.x,cardScale.y); // // while (time < 1) // { // time += speed * Time.deltaTime; // // cardScale = Vector3.Lerp(startScale, destScale, time); // card.SetScale(cardScale); // // if (time > 0.5f && isReverseAnim == false) // { // isReverseAnim = true; // card.IsShapesActive(); // card.IsTextsActive(); // // card.IsBack = !card.IsBack; // card.SetBackgroundSprite(CardSystem.GetInstance().GetCardSprite(card.IsBack)); // } // // yield return null; // } // // yield return null; //} public IEnumerator SinAnimation(List <Card> cards) { WaitForSeconds delay = new WaitForSeconds(5); yield return(delay); delay = new WaitForSeconds(0.1f); for (int i = 0; i < cards.Count; i++) { cards[i].transform.DOMove(new Vector3( Mathf.Sin((360 / cards.Count + 1) * i * Mathf.Deg2Rad) * 5, Mathf.Cos((360 / cards.Count + 1) * i * Mathf.Deg2Rad) * 5), 5); yield return(delay); } delay = new WaitForSeconds(2); yield return(delay); StartCoroutine(CardSystem.GetInstance().AllCardReverse()); }
void Start() { GameManager.GetInstance().FadeOutWhiteImg(0.5f); CardSystem.GetInstance().AddAllCard(); CardSystem.GetInstance().SetCardActive(true); CardSystem.GetInstance().AllCardMoveDeck(DeckSystem.GetInstance().GetDeck(DeckTag.ANIMATION_RIGHT_DECK)); AiSystem.GetInstance().SetupOneCardAi(); if (PlayerSystem.GetInstance().Players.Count <= 0) { PlayerSystem.GetInstance().MyPlayerId = "1"; PlayerSystem.GetInstance().AddPlayer(PlayerTag.PLAYER_BOTTOM, "1", false); PlayerSystem.GetInstance().AddPlayer(PlayerTag.PLAYER_LEFT_DOWN, "3", true); PlayerSystem.GetInstance().AddPlayer(PlayerTag.PLAYER_TOP, "2", true); PlayerSystem.GetInstance().AddPlayer(PlayerTag.PLAYER_RIGHT_UP, "4", true); TurnSystem.GetInstance().AddTurnPlayer("1"); TurnSystem.GetInstance().AddTurnPlayer("2"); TurnSystem.GetInstance().AddTurnPlayer("3"); TurnSystem.GetInstance().AddTurnPlayer("4"); //NetworkSystem.GetInstance().SendServer("FIND-ROOM:" + "1"); } StartCoroutine(StartScene()); this.UpdateAsObservable() .Subscribe(_ => { if (!GameManager.GetInstance().IsStartGame) { return; } var nowId = TurnSystem.GetInstance().PlayerNowTurn.Value; if (nowId == PlayerSystem.GetInstance().MyPlayerId) { InputSystem.GetInstance().TouchUpdate(); } }); TurnSystem.GetInstance().PlayerNowTurn.Subscribe(name => { if (name == "") { return; } if (PlayerSystem.GetInstance().GetPlayer(name).IsAi) { AiSystem.GetInstance().IsStartAi.Value = true; } if (name == PlayerSystem.GetInstance().MyPlayerId) { OnTurnEndBtn(); } }); TurnSystem.GetInstance().IsFinishTurn.Subscribe(finish => { if (!GameManager.GetInstance().IsStartGame) { return; } if (finish) { Observable.Timer(TimeSpan.FromSeconds(1)) .Subscribe(_ => { if (GameManager.GetInstance().CheckDefeatPlayer()) { return; } if (GameManager.GetInstance().CheckWinPlayer()) { return; } GameManager.GetInstance().FillDecktoDeckofAttack(DeckTag.PUT_DECK, DeckTag.DRAW_DECK); }); } }); }