Пример #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;
    }