Exemple #1
0
        public void Update(GameTime gameTime)
        {
            if (_gameEngine.IsGameStarted && !IsPause)
            {
                if (_gameEngine.ThereIs2VisibleCards)
                {
                    // Start process of checking matching
                    if (_delay == 0)
                    {
                        _checkingMatchProccess = true;
                        if (_gameEngine.CheckMatch(true))
                        {
                            StartMatchEffect(gameTime);
                            _delay = DELAY_IN_MATHCING;
                        }
                        else
                        {
                            _delay = DELAY_BEFORE_CHECK_MATHCING;
                        }
                    }

                    // Still in delay
                    if (_delay > 0)
                    {
                        _delay -= gameTime.ElapsedGameTime.TotalMilliseconds;
                    }
                    else // Stop delay and check matching
                    {
                        _delay = 0;
                        _gameEngine.CheckMatch();
                        _checkingMatchProccess = false;
                    }
                }
                _cardsCollection.Update(gameTime);
                UpdatePlayers(gameTime);
            }

            GetInputPosition(out Vector2? dummy, out bool isPressing);
            _isMouseAlreadyPressed = isPressing;
        }