예제 #1
0
        private int getAngle(SnakeMovePos movePos)
        {
            switch (movePos.GetDirection())
            {
            case Direction.Right:
                switch (movePos.getPrevDirection())
                {
                default:
                    return(90);

                case Direction.Down:
                    return(45);

                case Direction.Up:
                    return(-45);
                }

            case Direction.Left:
                switch (movePos.getPrevDirection())
                {
                default:
                    return(-90);

                case Direction.Down:
                    return(-45);

                case Direction.Up:
                    return(45);
                }

            case Direction.Up:
                switch (movePos.getPrevDirection())
                {
                default:
                    return(0);

                case Direction.Left:
                    return(45);

                case Direction.Right:
                    return(-45);
                }

            case Direction.Down:
                switch (movePos.getPrevDirection())
                {
                default:
                    return(180);

                case Direction.Left:
                    return(180 - 45);

                case Direction.Right:
                    return(180 + 45);
                }

            default: return(0);
            }
        }
예제 #2
0
 public Direction getPrevDirection()
 {
     if (this.lastMovePos == null)
     {
         return(Direction.Right);
     }
     return(lastMovePos.GetDirection());
 }