Пример #1
0
    /// <summary>
    ///
    /// </summary>
    public void initializeGraph()
    {
        if (awake == false)
        {
            UpdateSize();



            currentPositions = new List <Vector3>(countX * countZ * countY);
            savedPositions   = new List <Vector3>(countX * countZ * countY);
            _edgeGraph       = new SharedEdgeGraph();
            _edgeGraph.Initialize(EdgeGraph.Factory.CreateTriangleGrid3D(countX, countY, countZ));

            savedPositions.AddRange(SetVertexPosition());
            currentPositions.AddRange(savedPositions);
            _edgeGraph.TensileIcosahedron.AddRange(CreatVertexObjects());

            Depths = new int[_edgeGraph.edgeGraph.VertexCount];



            transform.position = new Vector3(-countX * Scale * 0.5f, -countY * Scale * 0.5f, -countZ * Scale * 0.5f);
            awake = true;


            GetComponent <IcosaUnitGrowthManager>().initializeGrowther();
        }
        else
        {
            ResetGraph();

            initializeGraph();
        }
    }
Пример #2
0
    private void Awake()
    {
        CG = new SharedEdgeGraph <Cells, CellEdge>();
        CG.Initialize(EdgeGraph.Factory.CreateTetrahedronGrid(CountX, CountY, CountZ));



        SavedPositions = SetPosition(CountX, CountY, CountZ, GridScale).ToList();

        CG.VertexObjects.AddRange(CreateVertex());
        CG.EdgeObjects.AddRange(CreateEdge());

        //foreach (var p in SavedPositions)
        //{
        //    var c = Instantiate(CellPrefab,transform);
        //    c.transform.localPosition = p;
        //    c.transform.localScale *= GridScale;
        //}
    }
Пример #3
0
    public void initializeGrowther()
    {
        GraphManager = transform.GetComponent <HexigonIcosaGraphManager>();

        GraphDone = GraphManager.GraphDone();

        displayed = false;

        HexigonGrid  = GraphManager._hexGrid();
        _graph       = HexigonGrid.edgeGraph;
        Depth        = new int[_graph.VertexCount];
        TenVertex    = HexigonGrid.TensileIcosahedron;
        _queue       = new Queue <int>();
        _sourceQueue = new Queue <int>();


        countX = GraphManager.GetCountX();
        countY = GraphManager.GetCountY();
        countZ = GraphManager.GetCountZ();
    }
Пример #4
0
    public void initializeGrowther()
    {
        GraphManager = transform.GetComponent <TriangleBoundryGraphManager>();

        Scale = GraphManager.getScale();

        GraphDone = GraphManager.GraphReady();

        displayed = false;

        HexigonGrid = GraphManager.Grid();
        _graph      = HexigonGrid.edgeGraph;

        TenVertex = HexigonGrid.TensileVertexObjects;
        TenEdge   = HexigonGrid.TensileEdgeObjects;

        SegCount   = GraphManager.GetSegmentCount();
        LayerCount = GraphManager.GetLayerCount();
        CheckEdges();
    }
Пример #5
0
    public void initializeGraph()
    {
        if (awake == false)
        {
            UpdateSize();


            _edgeGraph = new SharedEdgeGraph();
            _edgeGraph.Initialize(EdgeGraph.Factory.CreateDecreasingTriangleGrid(SegmentCount, LayerCount));

            currentPositions = new List <Vector3>(_edgeGraph.edgeGraph.VertexCount);
            savedPositions   = new List <Vector3>(_edgeGraph.edgeGraph.VertexCount);

            savedPositions.AddRange(SetVertexPosition());
            currentPositions.AddRange(savedPositions);
            _edgeGraph.TensileVertexObjects.AddRange(CreatVertexObjects());
            _edgeGraph.TensileEdgeObjects.AddRange(CreatEdgeObjects());
            _edgeGraph.TensileTriangle.AddRange(CreateTriangle());
            ConnectEdgeToVert();
            ConnectVertexs();
            Triangle = _edgeGraph.TensileTriangle.ToArray();

            enableVertexes();

            getNoise();

            transform.position = new Vector3(-SegmentCount * 0.5f, -LayerCount * 0.5f, -SegmentCount * 0.5f);
            awake = true;

            GetComponent <TriangleBoundryGrowthManager>().initializeGrowther();
            btn.interactable  = true;
            btn2.interactable = true;
        }
        else
        {
            ResetGraph();

            initializeGraph();
        }
    }
Пример #6
0
    public void initializeGraph()
    {
        if (awake == false)
        {
            UpdateSize();

            currentPositions = new List <Vector3>(countX * countZ * countY);
            savedPositions   = new List <Vector3>(countX * countZ * countY);
            _edgeGraph       = new SharedEdgeGraph();
            _edgeGraph.Initialize(EdgeGraph.Factory.CreateTriangleGrid3D(countX, countZ, countY));

            savedPositions.AddRange(SetVertexPosition());
            currentPositions.AddRange(savedPositions);
            _edgeGraph.TensileVertexObjects.AddRange(CreatVertexObjects());
            _edgeGraph.TensileEdgeObjects.AddRange(CreatEdgeObjects());
            _edgeGraph.TensileTriangle.AddRange(CreateTriangle());
            ConnectEdgeToVert();
            ConnectVertexs();
            Triangle = _edgeGraph.TensileTriangle.ToArray();

            enableVertexes();

            getNoise();

            transform.position = new Vector3(-countX * 0.5f, -countY * 0.5f, -countZ * 0.5f);
            awake = true;

            GetComponent <HexigonGrowthManager>().initializeGrowther();
            btn.interactable  = true;
            btn2.interactable = true;
        }
        else
        {
            ResetGraph();

            initializeGraph();
        }
    }