Ejemplo n.º 1
0
        /// <summary>
        /// Intial setup Method
        /// Will setup console size, and initial vector positions
        /// </summary>
        private static void Setup()
        {
            Console.WindowHeight = height;
            Console.WindowWidth  = width;

            Rows = Console.WindowHeight - 0;
            Cols = Console.WindowWidth - 1;

            if (Player == null)
            {
                Player = new VecC(Cols / 2, Rows / 2);
            }
            if (Food == null)
            {
                Food = VecC.GetRandomVector();
            }


            // Start the input thread
            InputThread = new Thread(() => GetUserInput());
            InputThread.IsBackground = true;
            InputThread.Start();

            Running = true;

            DrawGrid();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Update Vector Info
        /// </summary>
        private static void Update()
        {
            //Player.RandomWalk();
            Player.UpdatePosition();
            Player.CheckWallCollision();
            //Player.Bounce();

            if (Player.HasColliedWith(Food))
            {
                Food = VecC.GetRandomVector();
            }
        }