public IEnumerator HandleFlipAllForwardAnim() { isAnimating = true; for (int idx = curIdx; idx < allCards.Length; idx++) { RenderCard card = allCards[idx]; Vector3 startDestination = startPoint.transform.localPosition + Vector3.up * cardThickness * (allCards.Length - 1 - idx), endDestination = endPoint.transform.localPosition + (Vector3.up * cardThickness * idx), midPointDestination = midPoint.transform.localPosition; for (int x = 0; x <= 5; x++) { card.RotateCard(Vector3.forward * 15); card.gameObject.transform.localPosition = (midPointDestination * x + startDestination * (5 - x)) / 5f; yield return(null); } for (int x = 0; x <= 5; x++) { card.RotateCard(Vector3.forward * 15); card.gameObject.transform.localPosition = (endDestination * x + midPointDestination * (5 - x)) / 5f; yield return(null); } curIdx++; } yield return(null); isAnimating = false; }
public IEnumerator HandleFlipBackwardsAnim() { isAnimating = true; if (curIdx > 0) { curIdx--; RenderCard card = allCards[curIdx]; Vector3 startDestination = startPoint.transform.localPosition + Vector3.up * cardThickness * (allCards.Length - 1 - curIdx), endDestination = endPoint.transform.localPosition + (Vector3.up * cardThickness * curIdx), midPointDestination = midPoint.transform.localPosition; for (int x = 0; x <= 5; x++) { card.RotateCard(Vector3.forward * -15); card.gameObject.transform.localPosition = (endDestination * (5 - x) + midPointDestination * x) / 5f; yield return(null); } for (int x = 0; x <= 5; x++) { card.RotateCard(Vector3.forward * -15); card.gameObject.transform.localPosition = (midPointDestination * (5 - x) + startDestination * x) / 5f; yield return(null); } } yield return(null); isAnimating = false; }
void Heal() { RenderCard script = selectedTarget.GetComponent <RenderCard>(); script.thisCard.cardHealth += 4; script.UpdateCard(); }
// Use this for initialization void Start() { for (int x = 0; x < allCards.Length; x++) { RenderCard card = allCards[x]; card.transform.localPosition = startPoint.transform.localPosition + Vector3.up * cardThickness * (allCards.Length - 1 - x); } }
// Start is called before the first frame update void Awake() { cardStack = new CardStack(initialFaceUp); render = gameObject.GetComponent <RenderCard>(); }
private void OnRenderCard() { RenderCard?.Invoke(this, null); }