예제 #1
0
        /// <summary>
        /// Check in which direction snake should move.
        /// </summary>
        private Direction CheckMoveDir()
        {
            Direction newDir;

            if (_turnCommand != null)
            {
                newDir       = _turnCommand.dir;
                _turnCommand = null;
            }
            else
            {
                newDir = Direction.FORWARD;
            }

            return(newDir);
        }
예제 #2
0
 /// <summary>
 /// Sets turn command. So in next movement snake will turn.
 /// </summary>
 private void OnTurnCommand(EventArgs args)
 {
     _turnCommand = (args as SnakeTurnCommandArgs).turnCommand;
 }