private IEnumerator ReturnCard(TimeCard card, float waitTime, RectTransform target) { yield return(new WaitForSeconds(waitTime)); float value = 1 - ((float)card.wrongCount / _gamePreset.wrongCount); card.SetFill(value, Color.Lerp(Color.red, Color.yellow, value)); card.MoveBack(target); }
private void LoadCardsFromPreset() { var list = _gamePreset.GetCards(); for (int i = 0; i < list.Count; i++) { CardData cardData = list[i]; TimeCard card = Instantiate(cardPrefab, cardSlots[i]); card.Init(cardData); _cards.Add(card); } }
private void Start() { _gamePreset = FindObjectOfType <PresetHolder>().gamePreset.timelinePreset; descriptionText.text = _gamePreset.description; LoadCardsFromPreset(); timeLine.GenerateTimeline(_gamePreset); timeLine.AddCards(_cards); _activeCard = cardSlots[0].GetChild(0).GetComponent <TimeCard>(); _activeCard.Activate(); }
private bool ActivateFirstCard() { Debug.Log("activating card"); Transform firstFilledSlot = cardSlots.FirstOrDefault(x => x.childCount != 0); if (firstFilledSlot) { _activeCard = firstFilledSlot.GetChild(0).GetComponent <TimeCard>(); _activeCard.Activate(); _interactable = true; return(true); } return(false); }