public virtual IEnumerator Grab(bool local, SC_BaseCard original, bool tween = true) { SC_GameManager GM = SC_GameManager.Instance; RectTransform rT = local ? GM.localHand : GM.otherHand; SC_UI_Card c = CreateCard(original, rT); c.Card.Stolen = local != Local; if (!local) { c.RecT.anchorMin = c.RecT.anchorMax = c.RecT.pivot = new Vector2(.5f, 1); } if (IsDiscard || (local && !tween)) { c.SetImages(); } SC_Deck.OrganizeHand(rT); if (tween) { Vector3 target = c.transform.localPosition; c.transform.position = transform.position; c.Flip(local && !IsDiscard, GM.drawSpeed); yield return(c.transform.DOLocalMove(target, GM.drawSpeed, true).WaitForCompletion()); } (local ? SC_Player.localPlayer : SC_Player.otherPlayer).AddCard(c.Card); }
public override SC_UI_Card CreateCard(SC_BaseCard original, RectTransform parent = null) { SC_UI_Card c = base.CreateCard(original, parent); Destroy(original.UICard.gameObject); return(c); }
public virtual SC_UI_Card CreateCard(SC_BaseCard original, RectTransform parent = null) { SC_UI_Card c = SC_BaseCard.Create(original, parent ?? RecT); GetCards().Remove(original); return(c); }
public static SC_UI_Card Create(SC_BaseCard original, Transform parent) { SC_UI_Card c = Instantiate(Resources.Load <SC_UI_Card> ("Prefabs/Cards/P_UI_Card"), parent); c.name = original.Path; c.Card = Instantiate(Resources.Load <SC_BaseCard> (c.name), c.transform); c.Card.UpdateValuesUI(true); return(c); }
IEnumerator GrabbedToRing() { for (int i = Caller.Hand.Count - handSize; i > 0; i--) { ApplyingEffects = true; SC_UI_Card target = null; for (int j = handSize; j < Caller.Hand.Count; j++) { if (!target || Caller.Hand[j].matchHeat > target.Card.matchHeat) { target = Caller.Hand[j].UICard; } } target.transform.SetParent(transform); Caller.Hand.Remove(target.Card); additionalCardsToModify.Add(target.Card); SC_Deck.OrganizeHand(Caller.IsLocalPlayer ? GM.localHand : GM.otherHand); target.RecT.anchorMin = target.RecT.anchorMax = target.RecT.pivot = Vector2.one * .5f; target.Flip(!Caller.IsLocalPlayer, 1); yield return(target.RecT.DOAnchorPos(Vector2.zero, 1).WaitForCompletion()); target.transform.SetAsLastSibling(); target.BigRec.anchorMin = target.BigRec.anchorMax = target.BigRec.pivot = Vector2.one * .5f; target.BigRec.anchoredPosition = Vector2.zero; } cardHovered = new OnCardHovered((c, b) => { if (c == this) { c.UICard.ShowBigCard(false); transform.GetChild(transform.childCount - 1).GetComponent <SC_UI_Card> ().CantPlay = b; transform.GetChild(transform.childCount - 1).GetComponent <SC_UI_Card> ().ShowBigCard(b); } }); OnCardHoveredEvent += cardHovered; FinishedUsing(); }
IEnumerator DrawSignatureMove() { while (ApplyingEffects && Caller.IntChoices["SignatureMoveDraw"] == -1) { yield return(new WaitForEndOfFrame()); } UICard.OverrideActiveHover = false; if (ApplyingEffects) { Caller.SkipDraw = true; RectTransform rT = Caller.IsLocalPlayer ? GM.localHand : GM.otherHand; SC_UI_Card c = transform.GetChild(transform.childCount - 1).GetComponent <SC_UI_Card> (); c.RecT.anchorMin = c.RecT.anchorMax = c.RecT.pivot = c.BigRec.anchorMin = c.BigRec.anchorMax = c.BigRec.pivot = new Vector2(.5f, Caller.IsLocalPlayer ? 0 : 1); c.BigRec.anchoredPosition = Vector2.up * GM.yOffset; c.transform.SetParent(rT); SC_Deck.OrganizeHand(rT); Vector3 target = c.transform.localPosition; c.transform.position = transform.position; yield return(c.transform.DOLocalMove(target, GM.drawSpeed, true).WaitForCompletion()); Caller.Hand.Add(c.Card); additionalCardsToModify.Remove(c.Card); c.CantPlay = false; if (GetComponentsInChildren <SC_BaseCard> ().Length == 1) { OnCardHoveredEvent -= cardHovered; UICard.ToGraveyard(1, AppliedEffects, false); } else { ApplyingEffects = false; } } }
public override SC_UI_Card CreateCard(SC_BaseCard original, RectTransform parent = null) { SC_UI_Card c = base.CreateCard(original, parent); if (cards.Count <= 0) { GetComponent <Image> ().enabled = false; TSize.gameObject.SetActive(false); } else { TSize.text = Size.ToString(); } return(c); }
protected override IEnumerator ApplyEffects() { yield return(StartCoroutine(base.ApplyEffects())); string choice = Caller.GetStringChoice("KnowYourOpponent").Replace(" ", "").ToLower(); foreach (SC_BaseCard c in Receiver.Hand) { if (c.name.Replace("(Clone)", "").Replace(" ", "").ToLower() == choice) { yield return(StartCoroutine(ApplyEffect(() => { ApplyingEffects = true; c.Discard(Receiver); }))); break; } } foreach (SC_BaseCard c in Receiver.Deck.cards) { if (c.name.Replace("(Clone)", "").Replace(" ", "").ToLower() == choice) { yield return(StartCoroutine(ApplyEffect(() => { ApplyingEffects = true; SC_UI_Card card = Receiver.Deck.CreateCard(c); card.RecT.anchoredPosition = Vector2.zero; card.Card.Caller = Receiver; card.ToGraveyard(GM.drawSpeed, AppliedEffects, true); }))); break; } } }