private IEnumerator MovePawnPosTask(bool smooth) { SmothTransform ST = PanelPawn.GetComponent <SmothTransform> (); if (ST) { Vector3 destPos; int AnimSpeed = 10; while (true) { yield return(new WaitForSeconds(0.05f)); if (Controller != null) { AnimSpeed = Controller.AnimationSpeed; } if (GetPositionForPawn()) { destPos = CardPos1.position; } else { destPos = CardPos2.position; } ST.SmoothGlobalTransformTo(destPos, AnimSpeed); if (ST != null) { Debug.Log("Move pawn on panel"); while (ST.smoothTransformGlobalPosRunning) { if (GetPositionForPawn()) { destPos = CardPos1.position; } else { destPos = CardPos2.position; } ST.SmoothGlobalTransformTo(destPos, AnimSpeed); yield return(new WaitForSeconds(0.05f)); } } else { Debug.LogWarning("Missing SmothTransform component in pawn"); } if (!smooth) { break; } yield return(new WaitForSeconds(0.05f)); } SetPawnPos(); } else { Debug.LogError("Cannot get smooth transform component: " + PanelPawn); } }
private IEnumerator GetCardAnim(GameObject card) { Vector3 posNow = card.transform.localPosition; SmothTransform ST = card.GetComponent <SmothTransform> (); Vector3 upPos = new Vector3(posNow.x, posNow.y + UpPos, posNow.z); Vector3 downPos = new Vector3(posNow.x, posNow.y + DownPos, posNow.z); ST.SmothTransformTo(upPos, 10); yield return(new WaitForSeconds(0.1f)); ST.SmothTransformTo(downPos, 10); }
private IEnumerator AddCardFromPack(GameObject card, GameObject panel, int i, CardsBase.CardDescriptionClass cardDesc) { SmothTransform ST = card.GetComponent <SmothTransform> (); yield return(new WaitForSeconds(0.5f)); yield return(new WaitForSeconds(0.1f * i)); card.transform.SetParent(panel.transform, true); ST.SmothTransformTo(new Vector3(0, 0, 0), Quaternion.identity, MovingSpeed); ST.SmoothScaleTo(new Vector3(CardReversEndScale, CardReversEndScale, CardReversEndScale), MovingSpeed); if (cardDesc != null) { if (cardDesc.Rarity == CardInteraction.CardRarityEnum.gold) { Instantiate(GoldCardRay, card.transform); } else if (cardDesc.Rarity == CardInteraction.CardRarityEnum.diamond) { Instantiate(DiamondCardRay, card.transform); } } }
private IEnumerator CardAnimation(Vector3 newPos, Vector3 newScale, GameObject UnblockedCard) { if (UnblockedCard != null) { DisableOtherCards(UnblockedCard); } else { DisableOtherCards(null); } SmothTransform SMT = GetComponent <SmothTransform> (); SMT.smoothTransformPosRunning = false; SMT.smoothTransformScaleRunning = false; SMT.SmothTransformTo(newPos, 10); SMT.SmoothScaleTo(newScale, 10); yield return(new WaitForSeconds(0.5f)); if (UnblockedCard == null) { StartCoroutine(EnableOtherCardsDelayed()); } }
public void AddCardToStartHand(GameObject card, int CardNumber) { Debug.Log("Add card :" + card); bool found = false; foreach (GameObject panel in PanelsList) { if (panel != null) { StartHandPanel handPanel = panel.GetComponent <StartHandPanel> (); if (handPanel.CardDeckNumber == CardNumber) { Debug.Log("found free panel :" + panel); if (handPanel.Card != null) { Destroy(handPanel.Card); } handPanel.Card = card; handPanel.StartHandComponent = GetComponent <StartHand> (); card.GetComponent <CardInteraction> ().cardHandIndex = PanelsList.IndexOf(panel); card.transform.SetParent(panel.transform); SmothTransform STF = card.GetComponent <SmothTransform> (); STF.SmoothScaleTo(new Vector3(CardScale, CardScale, CardScale), 10); Quaternion rot = Quaternion.identity; rot.eulerAngles = new Vector3(0, 0, 0); STF.SmothTransformTo(CardPosition, rot, 10); found = true; break; } } } if (!found) { card.GetComponent <CardInteraction> ().SetCardInterationsEnable(true); HandComponent.AddCardToHand(card); } }
/* swipe detection*/ void Start() { //Debug.Log ("New card starts life"); if (GameObject.Find("Gameplay") != null) { GameplayController = GameObject.Find("Gameplay").GetComponent <GamePlay> (); } cardSpriteRender = GetComponent <SpriteRenderer> (); if (transform.Find("Pawn")) { pawnTransform = transform.Find("Pawn"); pawnStartPosition = pawnTransform.localPosition; //startPawnScale = pawnTransform.localScale; pawnComponent = pawnTransform.GetComponent <Pawn> (); } startLayer = cardOrder * 10; cardSpriteRender.sortingOrder = startLayer; //startPos = transform.position; //startScale = transform.localScale; //startRotation = transform.localEulerAngles; VectorOverMouseScale = new Vector3(OverMouseScale, OverMouseScale, OverMouseScale); GetComponent <Renderer> ().shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.On; GetComponent <Renderer> ().receiveShadows = true; if (GameObject.Find("Hand") != null) { HandComp = GameObject.Find("Hand").GetComponent <Hand> (); } /*if (GameObject.Find ("DeckTable") != null) { * DeckScrollComp = GameObject.Find ("DeckTable").GetComponent<DeckCardsScroll> (); * }*/ SmoothTrComp = GetComponent <SmothTransform> (); SetCardCost(CardCost); }