     @destroy() if @energy <= 0
   destroy_area: ->
     switch @direction
-      when 0
+      when Direction.UP
         new MapArea2D(
           @area.x1 - @default_width/4,
           @area.y1 - @default_height/4,
           @area.x2 + @default_width/4,
           @area.y1
         )
-      when 90
+      when Direction.RIGHT
         new MapArea2D(
           @area.x2,
           @area.y1 - @default_height/4,
           @area.x2 + @default_width/4,
           @area.y2 + @default_height/4
         )
-      when 180
+      when Direction.DOWN
         new MapArea2D(
           @area.x1 - @default_width/4,
           @area.y2,
           @area.x2 + @default_width/4,
           @area.y2 + @default_height/4
         )
-      when 270
+      when Direction.LEFT
         new MapArea2D(
           @area.x1 - @default_width/4,
           @area.y1 - @default_height/4,

    @direction = @map_unit.direction
    @commands = []
  direction_action_map: {
    up: 0,
    down: 180,
    left: 270,
    right: 90
  }
  # calculate next commands
  next: () ->

class Direction
  @UP: 0
  @DOWN: 180
  @LEFT: 270
  @RIGHT: 90
  @all: () -> [@UP, @DOWN, @LEFT, @RIGHT]

