示例#1
0
文件: Fruit.cs 项目: Genjo15/Snake
        /*
         * Method which determines if the snake has reached the item
         * */
        public Boolean IsReached(SnakePart snake)
        {
            Boolean isReached = false;

            if ((snake.Get_X() == _X) && (snake.Get_Y() == _Y))
                isReached = true;

            return isReached;
        }
示例#2
0
文件: Insect.cs 项目: Genjo15/Snake
        /*
         * Method which determines if the snake has reached the insect
         */
        public Boolean IsReached(SnakePart snakePart)
        {
            Boolean isReached = false;

            if (((snakePart.Get_X() == _X) && (snakePart.Get_Y() == _Y)) || ((snakePart.Get_X() == (_X + (_Side / 2 + 1))) && (snakePart.Get_Y() == _Y)) || ((snakePart.Get_X() == _X) && (snakePart.Get_Y() == (_Y + (_Side / 2) + 1))) || ((snakePart.Get_X() == (_X + (_Side / 2 + 1))) && (snakePart.Get_Y() == (_Y + (_Side / 2) + 1))))
                isReached = true;

            return isReached;
        }