protected override void HandleFrameUpdate(float elapsedTime)
        {
            base.HandleFrameUpdate(elapsedTime);

            // Check if the player is visible
            if (IsPlayerVisible())
            {
                // Start persuit of the player
                var persuit = new AIStatePersuit(controller);
                stateMachine.MoveTo(persuit);
            }
        }
        protected override void HandleFrameUpdate(float elapsedTime)
        {
            base.HandleFrameUpdate(elapsedTime);

            if (IsPlayerVisible())
            {
                var persuit = new AIStatePersuit(controller);
                stateMachine.MoveTo(persuit);
                return;
            }

            // Since the player is not visible while we are patrolling, clear the last sighting
            controller.LastSighting.ClearSighting();

            var agent = controller.Agent;

            if (agent.GetRemainingDistance() < controller.destinationArriveProximity)
            {
                currentWaypointIndex++;
            }
            MoveToCurrentPoint();
        }
        protected override void HandleFrameUpdate(float elapsedTime)
        {
            base.HandleFrameUpdate(elapsedTime);

            // Check if we can see the player
            if (IsPlayerVisible())
            {
                // The player is visible.  Start persuit of the player
                var persuit = new AIStatePersuit(controller);
                stateMachine.MoveTo(persuit);
                return;
            }

            // Check if we are near the last sighting position;
            if (controller.Agent.GetRemainingDistance() < controller.destinationArriveProximity)
            {
                // We have reached the last sighting position and still haven't found the player
                // Stand here and wait for a bit before returing to patrolling
                var waitAndSearch = new AIStateWaitAndSearch(controller);
                stateMachine.MoveTo(waitAndSearch);
            }
        }
        protected override void HandleFrameUpdate(float elapsedTime)
        {
            base.HandleFrameUpdate(elapsedTime);

            // Check if the player is visible
            if (IsPlayerVisible())
            {
                // Start persuit of the player
                var persuit = new AIStatePersuit(controller);
                stateMachine.MoveTo(persuit);
            }

            timeSinceStart += elapsedTime;
            if (timeSinceStart >= controller.searchWaitTime)
            {
                // The player is not found and is lost. Clear the last sighting variable
                controller.LastSighting.ClearSighting();

                // Return back to the patrol state
                var patrol = new AIStatePatrol(controller);
                stateMachine.MoveTo(patrol);
            }
        }