Ejemplo n.º 1
0
 void onClickReset()
 {
     Refresh();
     UserSelector.currentRegionRadius = userSelector.regionRadius;
     isRiding = false;
     UserSelector.selectedNode = null;
     DestroyGraph();
     nodeList.Clear();
     GenerateGraph();
     carGenerator.Generate(carCount);
     algoAntColony.KillAntColonies();
     DestroyPheremones();
 }
Ejemplo n.º 2
0
    // 0 = no Simulation
    // 1 = Euclidean
    // 2 = Ant Colony
    // 3 = MPAC


    //GameObject EuclideanCar = null;
    //GameObject AntCar = null;
    //GameObject MPACCar = null;


    // Use this for initialization
    void Start()
    {
        nodeCount     = nodeGrid * nodeGrid;
        algoEuclidean = gameObject.GetComponent <Euclidean> ();
        algoAntColony = gameObject.GetComponent <AntColonyController> ();
        algoMPAC      = gameObject.GetComponent <MPAC> ();

        userSelector = gameObject.GetComponent <UserSelector> ();
        carGenerator = gameObject.GetComponent <CarGenerator> ();
        // create the under laying surface
        GameObject surface;

        surface = GameObject.CreatePrimitive(PrimitiveType.Quad);
        surface.transform.Rotate(new Vector3(90, 0, 0));
        surface.transform.localScale = new Vector3(2 * boundry, 2 * boundry, 1);
        surface.GetComponent <MeshRenderer> ().material = groundMat;
        GenerateGraph();
        isMapGenerated = true;

        resetButton.onClick.AddListener(onClickReset);


        btnEuclidean.onClick.AddListener(onClickEuclidean);
        btnAntColony.onClick.AddListener(onClickAntColony);
        btnMPAC.onClick.AddListener(onClickMPAC);
        sliderAntSpeed.onValueChanged.AddListener(onSliderValueChange);
        sliderPheremoneEvaporate.onValueChanged.AddListener(onPheremoneSliderValueChange);
        btnRefresh.onClick.AddListener(onRefreshButton);
        toggleHideAnts.onValueChanged.AddListener((value) => { onToggleHideAnts(); });


        toggleGenderPref.onValueChanged.AddListener((value) => { onToggleGenderPref(value); });
        toggleAgePref.onValueChanged.AddListener((value) => { onToggleAgePref(value); });
        Gender_Male.onValueChanged.AddListener((value) => { onToggleGenderMale(value); });
        Gender_Female.onValueChanged.AddListener((value) => { onToggleGenderFemale(value); });

        Age_30.onValueChanged.AddListener((value) => { onToggleAge30(value); firstAgeCall = true; });
        Age_49.onValueChanged.AddListener((value) => { onToggleAge49(value); firstAgeCall = true; });
        Age_50.onValueChanged.AddListener((value) => { onToggleAge50(value); firstAgeCall = true; });

        SaveButton.onClick.AddListener(onClickSave);

        carGenerator.Generate(carCount);
    }