private void Dot_OnSelected(object sender, DotEventArgs dotEventArgs) { if (!HasMoveStarted) { StartMove(dotEventArgs.CurrentDot); } }
protected virtual void OnEntered(DotEventArgs e) { var handler = Entered; if (handler != null) { handler(this, e); } }
private void Dot_OnDeselected(object sender, DotEventArgs dotEventArgs) { if (!HasMoveStarted) { return; } CheckMove(); LinePainter.Instance.StopPainting(); }
private void Dot_OnEntered(object sender, DotEventArgs dotEventArgs) { if (!HasMoveStarted) { return; } // The dot you just entered var currentDot = dotEventArgs.CurrentDot; switch (currentDot.DotType) { case DotTypes.None: Debug.LogError("Invalid Dot Type"); break; case DotTypes.Normal: if (IsValid((NormalDot)currentDot)) { if ((_selectedDots.Count >= 2) && IsDeselecting(currentDot)) { _selectedDots[_lastSelectedDotNumber].Animator.FinishAnimations(); _selectedDots.RemoveAt(_lastSelectedDotNumber); _lastSelectedDotNumber--; LinePainter.Instance.RemoveLastPosition(); OnDotDeselected(); } else { _isSquareAnnounced = IsSquare(); if ((!IsSquare() && _selectedDots.Contains(currentDot)) || !_selectedDots.Contains(currentDot)) { currentDot.Select(); _selectedDots.Add(currentDot); _lastSelectedDotNumber++; LinePainter.Instance.AddPosition(currentDot.transform.position); OnDotSelected(); } if (IsSquare() && !_isSquareAnnounced) { _isSquareAnnounced = true; OnSquareSelected(); } } } break; default: throw new InvalidEnumArgumentException(); } }