예제 #1
0
 private void handleMoveAction(Action action)
 {
     List<Tile> path = action.payload ["path"] as List<Tile>;
     if (path.Count > 0) {
         Tile goal = path [0];
         GridThing moveable =  action.payload ["moveable"] as GridThing;
         Vector3 moveable_pos = moveable.getRealPosition();
         if (Mathf.Approximately(goal.grid_x,moveable_pos.x) && Mathf.Approximately(goal.grid_y, moveable_pos.y)) {
             path.Remove(goal);
             // TODO: set tile
             moveable.setGridPosition(grid, goal.grid_x, goal.grid_y);
         } else {
             moveable.setRealPosition( Vector3.MoveTowards(moveable_pos, new Vector3(goal.grid_x, goal.grid_y, 0f),ActionSpeed));
         }
     } else {
         ActionComplete(action);
     }
 }
예제 #2
0
 private void ActionComplete(Action action)
 {
     action.action_type = ActionType.none;
 }