public void SwitchMode(buildMode_t toMode)
 {
     if (buildMode == buildMode_t.PATROL_POINTS)
     {
         Destroy(movingTile.gameObject);
     }
     buildMode = toMode;
 }
    void PlaceTile()
    {
        Vector3 pos = GetMousePosInGrid();

        if (table.Contains(pos))
        {
            return;
        }
        currentTile = guiController.GetCurrentObject();
        currentTile = Instantiate(currentTile, pos, Quaternion.identity) as GameObject;
        currentTile.transform.parent = mapParent;
        table.Add(currentTile.transform.position, currentTile);
        if (currentTile.name.Contains("MovingTile"))
        {
            movingTile = currentTile.GetComponent <MovingTile>();
            movingTile = Instantiate(movingTile) as MovingTile;
            buildMode  = buildMode_t.PATROL_POINTS;
        }
    }
 void PlaceTile()
 {
     Vector3 pos = GetMousePosInGrid();
     if (table.Contains(pos))
         return;
     currentTile = guiController.GetCurrentObject();
     currentTile = Instantiate(currentTile,pos,Quaternion.identity) as GameObject;
     currentTile.transform.parent = mapParent;
     table.Add(currentTile.transform.position,currentTile);
     if (currentTile.name.Contains("MovingTile")){
         movingTile = currentTile.GetComponent<MovingTile>();
         movingTile = Instantiate(movingTile) as MovingTile;
         buildMode = buildMode_t.PATROL_POINTS;
     }
 }
 public void SwitchMode(buildMode_t toMode)
 {
     if (buildMode == buildMode_t.PATROL_POINTS){
         Destroy(movingTile.gameObject);
     }
     buildMode = toMode;
 }