public SingleEntityResult OfferSingleEntitySelection(ICollection <Entity> options) { SingleEntityResult result = new SingleEntityResult(); SingleEntitySelection ses = Instantiate(singleEntityPromptPrefab); ses.Initialize(this, options, result); ses.transform.parent = transform; activeSelection = ses; pendingResult = result; state = InterfaceState.BusyWithSelection; return(result); }
/// <summary> /// Moves the <see cref="CardRenderer"/> that matches the active card back into the hand. /// </summary> /// <remarks>Used to respond to <see cref="GameManager.OnCardDeselected"/></remarks> public void DeselectActiveCard() { if (activeCardRenderer != null) { hand.AddCardToHand(activeCardRenderer); hand.HoldCardsDown = false; activeCardRenderer.UpdateDescription(useStatic: true); activeCardRenderer = null; cancelCardButton.gameObject.SetActive(false); } if (state == InterfaceState.BusyWithSelection) { pendingResult = null; activeSelection.Cleanup(); activeSelection = null; state = InterfaceState.Idle; } }
public void Update() { switch (state) { case InterfaceState.BusyWithSelection: { if (pendingResult.IsReadyOrCancelled()) { pendingResult = null; activeSelection.Cleanup(); activeSelection = null; state = InterfaceState.Idle; } }; break; } if (activeCardRenderer != null) { activeCardRenderer.UpdateDescription(); //ABSOLUTELY DON'T DO THIS EVERY TURN } }