public IEnumerator FlyBack() { Flying = true; var swingRoutine = StartCoroutine(SwingDelay()); var cardType = GetComponent <CardLogic>().CardType; var target = (CardHand as CachedCardContainer).GetWaypoint(cardType); float elapsedTime = 0.0f; var heightTarget = new Vector3(transform.position.x, target.y, transform.position.z); //Match Y var matchYTime = TotalFlyTime * VerticalMoveTimePercent; while (elapsedTime < matchYTime) { transform.position = Vector3.Lerp( transform.position, heightTarget, elapsedTime / matchYTime ); elapsedTime += Time.deltaTime; yield return(null); } //Match X elapsedTime = 0.0f; var matchXTime = TotalFlyTime * (1 - VerticalMoveTimePercent); while (elapsedTime < matchXTime) { transform.position = Vector3.Lerp( transform.position, target, elapsedTime / matchXTime ); elapsedTime += Time.deltaTime; yield return(null); } if (swingRoutine != null) { StopCoroutine(swingRoutine); } Flying = false; CardHand.AddCard(gameObject); }
public void TestSimpleSum() { _cardHand.AddCard(GameObject.Instantiate(_card3)); _cardHand.AddCard(GameObject.Instantiate(_cardK)); Assert.AreEqual(13, _cardHand.GetHandValue()); }
/// <summary> /// Add a card to player's hand /// </summary> /// <param name="card">Card gameobject</param> public virtual void AddCardToHand(Card card) { _cardHand.AddCard(card); NotifyObservers(); }
public void Add() { GameObject cardInstance = Instantiate(card); hand.AddCard(cardInstance); }