Ejemplo n.º 1
0
    public void SetUp(TrafficEditorManage MM, Transform L1, Transform L2)
    {
        UTL = new Useful();

        Vertex = new Vector3[0];

        GetComponent <LineRenderer>().SetWidth(0.35f, 0.35f);

        GetComponent <LineRenderer>().SetColors(new Color(0, 1, 0, 1), new Color(1, 0, 0, 1));

        Manager = MM;

        first = true;

        Limits = new Transform[2];

        Limits[0] = L1;
        Limits[1] = L2;

        Apice = new Vector3(0, 0, 0);

        Mediana = new Vector3(0, 0, 0);

        N1 = new Vector3(0, 0, 0);

        Limits[0].GetComponent <CCP_Projector2>().Line = this.GetComponent <LineCCP2>();

        Limits[0].GetComponent <CCP_Projector2>().Reajusta_Direcao(Limits[1].position);

        Number_Nodes(Limits[0].GetComponent <CCP_Projector2>().Nodes);
    }
Ejemplo n.º 2
0
    void    StartET(int StartCars, int StartCCP)
    {
        Begin           = false;
        Started         = false;
        Manual          = false;
        AddCars         = StartCars;
        ManageCCP       = StartCCP;
        ToggleAdvanced  = false;
        WarningAdvanced = false;

        GameObject ET_CCP = Instantiate(Resources.Load("CCP_Projector2")) as GameObject;

        GameObject ET_LINE = Instantiate(Resources.Load("LineCCP0")) as GameObject;

        GameObject ET_TEMStart = Instantiate(Resources.Load("TrafficEditorManager")) as GameObject;

        GameObject PD0 = Instantiate(Resources.Load("PD0")) as GameObject;

        GameObject ET_TL = Instantiate(Resources.Load("Semaphores")) as GameObject;

        DestroyImmediate(ET_CCP.gameObject);

        DestroyImmediate(ET_LINE.gameObject);

        DestroyImmediate(ET_TEMStart.gameObject);

        DestroyImmediate(PD0.gameObject);

        DestroyImmediate(ET_TL.gameObject);

        if (!GameObject.FindGameObjectWithTag("ET_TEM"))
        {
            GameObject ET_TEM = Instantiate(Resources.Load("TrafficEditorManager")) as GameObject;
            ET_TEM.name = "TrafficEditorManager";
            ET_TEM.transform.position = new Vector3(0, 0, 0);
            EditorUtility.DisplayDialog("Easy Traffic Started!", "You now just created a new object called TrafficEditorManager, do not delete it or it will lose all your current settings.", "Close");
        }

        MainTEM = GameObject.FindGameObjectWithTag("ET_TEM").GetComponent <TrafficEditorManage>();

        MainTEM.GenerateChild("ControlPoints");
        MainTEM.GenerateChild("TrafficLights");
        MainTEM.GenerateChild("SpawnedCars");
        MainTEM.GenerateChild("Effects");

        MainTEM.SetUpToDate();


        Scale       = GetTEMScale();
        ScaleNew    = Scale;
        SizeRoad    = GetTEMRoadSize();
        SizeRoadNew = SizeRoad;
        Lanes       = GetTEMLanes();
        LanesNew    = Lanes;

        if (Scale >= 1)
        {
            ScaleFake = (Scale - 1) * 10;
        }

        if (Scale < 1)
        {
            ScaleFake = (Scale - 1) * 100;
        }


        Started = true;
    }
Ejemplo n.º 3
0
    public void Starter(TrafficEditorManage StarterManager, Vector3 PosNow)
    {
        SemaphorePos = new Vector3[0];

        Add_Semaphore = false;

        UTL = new Useful();

        Dead_end = true;

        MainTEM = StarterManager;

        Nodes = 0;

        Before = gameObject.transform.position;

        Distances = 0.0f;

        Arrows      = Instantiate(Resources.Load("Arrow1")) as GameObject;
        Arrows.name = "Arrow01";

        Arrows.transform.position = gameObject.transform.position;
        Arrows.transform.Translate(0, 0, -3);

        Arrows.transform.parent = gameObject.transform;


        first = true;

        string NewName = "CCP_Projector";

        name = NewName + MainTEM.Num_CCP;


        gameObject.transform.position = PosNow;

        if (MainTEM.Num_CCP > 0)
        {
            int sum = MainTEM.Num_CCP - 1;

            NewName += sum;

            GameObject NewCCPT = GameObject.Find(NewName);

            NewCCPT.GetComponent <CCP_Projector2>().Dead_end = false;

            if (!NewCCPT.GetComponent <CCP_Projector2>().Dead_end)
            {
                NewCCPT.GetComponent <CCP_Projector2>().Next = this.GetComponent <CCP_Projector2>();

                Prior = NewCCPT.transform;

                GameObject LineCCP = new GameObject();
                LineCCP.name = "LineCCP" + sum;

                LineCCP.transform.parent = NewCCPT.transform;

                LineCCP.gameObject.tag = "ET_LINE";

                LineCCP.AddComponent <LineRenderer>();

                LineCCP.GetComponent <LineRenderer>().material = Resources.Load("LineCCP2", typeof(Material)) as Material;

                LineCCP.AddComponent <LineCCP2>();

                LineCCP.GetComponent <LineCCP2>().SetUp(MainTEM, NewCCPT.transform, gameObject.transform);
            }
        }

        MainTEM.Add_CCP();

        MyNumber = MainTEM.Return_CPPProjectors();
    }