private void CheckChoiceChange(CardChoiceState newChoice) { if (newChoice == choice) { return; } if (newChoice == CardChoiceState.Left) { dispatcher.Dispatch(CardEvent.Prepare, newChoice, choice); dispatcher.Dispatch(CardEvent.PrepareLeft, newChoice, choice); } else if (newChoice == CardChoiceState.Right) { dispatcher.Dispatch(CardEvent.Prepare, newChoice, choice); dispatcher.Dispatch(CardEvent.PrepareRight, newChoice, choice); } if (choice == CardChoiceState.Left) { dispatcher.Dispatch(CardEvent.ExitPrepare, newChoice, choice); dispatcher.Dispatch(CardEvent.ExitPrepareLeft, newChoice, choice); } else if (choice == CardChoiceState.Right) { dispatcher.Dispatch(CardEvent.ExitPrepare, newChoice, choice); dispatcher.Dispatch(CardEvent.ExitPrepareRight, newChoice, choice); } choice = newChoice; }
/// <summary> /// Reset the card rectTransform when a new card is dispatched. /// </summary> private void OnDispatchEnd(params object[] data) { currentAngle = 0; card.localRotation = Quaternion.identity; currentCardPos = Vector2.zero; card.anchoredPosition = currentCardPos; choice = CardChoiceState.None; }
private void OnExecuteChoice(params object[] data) { choice = (CardChoiceState)data[0]; }