Exemplo n.º 1
0
    // Use this for initialization
    void Start()
    {
        search = GetSearchAlgorithm();
        TestWriter.Start(SceneManager.GetActiveScene().name + "_" + search.getName() + ".csv");
        targets = GetAllTargets();
        targets.Sort(GridMap.SortByName);
        UpdateStartTargetPositions();


        Node start_pos = GridMap.instance.NodeFromWorldPoint(transform.position);

        transform.position = start_pos.worldPosition + new Vector3(0f, 1f, 0f);

        currentCost                  = 0;
        moveToNext                   = false;
        isMoving                     = false;
        isDead                       = false;
        isAtTarget                   = false;
        currentForce                 = totalEnergy;
        currentEnergyExpanded        = totalEnergy;
        updateEnergyExpandedInterval = Mathf.Max(Mathf.RoundToInt(search.GetMaxNumberOfExpandedNodes() / totalEnergy), 1);
        updateForceInterval          = Mathf.Max(Mathf.RoundToInt(search.GetListSizeLimit() / (ulong)totalEnergy), 1);
        UpdateEnergyBars(healthForce, (int)currentForce, Color.blue);
        UpdateEnergyBars(healthExpandedBar, (int)currentEnergyExpanded, Color.yellow);
        gameObject.GetComponent <Renderer> ().material.color = agentColor;
    }
Exemplo n.º 2
0
    void MakeDead(Energies energy)
    {
        gameObject.GetComponent <Renderer> ().material.color = Color.black;
        uniText.text  = this.name + ": Dead... ";
        nodesExpanded = search.GetNumberOfNodesExpanded();
        ulong nodesOnList = search.GetMaxListSize();

        pathCost = search.pathCost;
        if (energy == Energies.Expanded)
        {
            uniText.text += "expanded: " + nodesExpanded + " >= " + search.maxNumberOfExpanded + "(maxNumberOfExpansions)";
        }
        else
        {
            uniText.text += "onlist: " + nodesOnList + " >= " + search.GetListSizeLimit() + "(GetListSizeLimit)";
        }
    }
Exemplo n.º 3
0
    void MakeDead(Energies energy)
    {
        gameObject.GetComponent <Renderer> ().material.color = Color.black;
        uniText.text  = this.name + ": Dead... ";
        nodesExpanded = search.GetNumberOfNodesExpanded();
        ulong nodesOnList = search.GetMaxListSize();

        pathCost = search.pathCost;
        if (energy == Energies.Expanded)
        {
            uniText.text += "expanded: " + nodesExpanded + " >= " + search.maxNumberOfExpanded + "(maxNumberOfExpansions)";
        }
        else
        {
            uniText.text += "onlist: " + nodesOnList + " >= " + search.GetListSizeLimit() + "(GetListSizeLimit)";
        }
        TestWriter.writeResultLine(false, -1, search.numberOfVisited, search.numberOfExpandedNodes, search.maxListSize, search.currentState.depth, search.getExtra());
        TestSceneControl.ChangeScene();
    }