public void ColorQuestion(AvailableColors _trueColor, AvailableColors _falseColor, bool equals = false) { if (_firstButton != null) { Destroy(_firstButton.gameObject); Destroy(_secondButton.gameObject); } if (equals) { _firstButton = Instantiate(_colorButtonPrefab, transform); _firstButton.transform.DOLocalMove(_firstButtonPosition.localPosition, 0.6f); _firstButton.CallOnButtonClick += () => CallOnQuestionTrue?.Invoke(); _firstButton.SetColor(_trueColor); _secondButton = Instantiate(_colorButtonPrefab, transform); _secondButton.transform.DOLocalMove(_secondButtonPosition.localPosition, 0.6f); _secondButton.CallOnButtonClick += () => CallOnQuestionTrue?.Invoke(); _secondButton.SetColor(_falseColor); return; } if (RandomBool()) { Debug.Log("rand true"); _firstButton = Instantiate(_colorButtonPrefab, transform); _firstButton.transform.DOLocalMove(_firstButtonPosition.localPosition, 0.6f); _firstButton.CallOnButtonClick += () => CallOnQuestionTrue?.Invoke(); _firstButton.SetColor(_trueColor); _secondButton = Instantiate(_colorButtonPrefab, transform); _secondButton.transform.DOLocalMove(_secondButtonPosition.localPosition, 0.6f); _secondButton.CallOnButtonClick += () => CallOnQuestionFalse?.Invoke(); _secondButton.SetColor(_falseColor); } else { Debug.Log("rand false"); _secondButton = Instantiate(_colorButtonPrefab, transform); _secondButton.transform.DOLocalMove(_secondButtonPosition.localPosition, 0.6f); _secondButton.CallOnButtonClick += () => CallOnQuestionTrue?.Invoke(); _secondButton.SetColor(_trueColor); _firstButton = Instantiate(_colorButtonPrefab, transform); _firstButton.transform.DOLocalMove(_firstButtonPosition.localPosition, 0.6f); _firstButton.CallOnButtonClick += () => CallOnQuestionFalse?.Invoke(); _firstButton.SetColor(_falseColor); } }
public void FigureAndColorCountQuestion(FigureType _trueFigure, FigureType _falseFigure, AvailableColors _trueColor, AvailableColors _falseColor, bool equals = false) { if (_firstButton != null) { Destroy(_firstButton.gameObject); Destroy(_secondButton.gameObject); } if (equals) { _firstButton = Instantiate(GetPrefabByFigureType(_trueFigure), transform); _firstButton.transform.DOLocalMove(_firstButtonPosition.localPosition, 0.3f); _firstButton.CallOnButtonClick += () => CallOnQuestionTrue?.Invoke(); _firstButton.SetColor(_trueColor); _secondButton = Instantiate(GetPrefabByFigureType(_falseFigure), transform); _secondButton.transform.DOLocalMove(_secondButtonPosition.localPosition, 0.3f); _secondButton.CallOnButtonClick += () => CallOnQuestionTrue?.Invoke(); _secondButton.SetColor(_falseColor); return; } if (RandomBool()) { _firstButton = Instantiate(GetPrefabByFigureType(_trueFigure), transform); _firstButton.transform.DOLocalMove(_firstButtonPosition.localPosition, 0.6f); _firstButton.CallOnButtonClick += () => CallOnQuestionTrue?.Invoke(); _firstButton.SetColor(_trueColor); _secondButton = Instantiate(GetPrefabByFigureType(_falseFigure), transform); _secondButton.transform.DOLocalMove(_secondButtonPosition.localPosition, 0.6f); _secondButton.CallOnButtonClick += () => CallOnQuestionFalse?.Invoke(); _secondButton.SetColor(_falseColor); } else { _secondButton = Instantiate(GetPrefabByFigureType(_trueFigure), transform); _secondButton.transform.DOLocalMove(_secondButtonPosition.localPosition, 0.6f); _secondButton.CallOnButtonClick += () => CallOnQuestionTrue?.Invoke(); _secondButton.SetColor(_trueColor); _firstButton = Instantiate(GetPrefabByFigureType(_falseFigure), transform); _firstButton.transform.DOLocalMove(_firstButtonPosition.localPosition, 0.6f); _firstButton.CallOnButtonClick += () => CallOnQuestionFalse?.Invoke(); _firstButton.SetColor(_falseColor); } }