Exemplo n.º 1
0
 void executeMovement()
 {
     // Move
     if (currentTarget < this.targetOrder.Count)
     {
         // Current path is finished
         if (currentPath.Count == 0)
         {
             currentTarget++;
             if (currentTarget < this.targetOrder.Count)
             {
                 setCurrentPath();
             }
             else
             {
                 // Tour is over
                 Debug.Log("Time to finish tour : " + (Time.time - begin));
                 return;
             }
         }
         MapGenetic.TileInfo v = ((MapGenetic.TileInfo)currentPath[currentPath.Count - 1].Vertex);
         this.model.move(v.x, v.y);
         this.transform.position = new Vector3(this.model.getPosX(), this.model.getPosY(), (model.BestSolution?-0.3f:-0.2f));
         // Removing the last vertex of the path because it was used by the character
         currentPath.RemoveAt(currentPath.Count - 1);
     }
 }
Exemplo n.º 2
0
    void initialPositioning()
    {
        currentTarget = 0;

        // poitioning the player at the first target
        int vertexIndex = this.model.Map.getCharacterGraphPosition(this.model.Map.Targets[this.targetOrder[currentTarget]]);

        MapGenetic.TileInfo vertex = this.model.Map.getTile(vertexIndex);
        this.model.setPos(new Vector2(vertex.x, vertex.y));
        this.transform.position = new Vector3(this.model.getPosX(), this.model.getPosY(), (model.BestSolution?-0.3f:-0.2f));

        // setting path
        this.setCurrentPath();
    }