Exemple #1
0
        private void InstantiateArcs()
        {
            var i = 0;

            foreach (var arc in _gameBoard.Arcs)
            {
                var arcView = _itemPool.GetArc();

                // Find the node at the arc's position and set it as a perent of this arc
                var parent = NodeMap[arc.Position].transform;
                arcView.transform.SetParent(parent);
                arcView.Init(arc, parent, _gameBoard.StartIsland.Contains(arc.ParentNode));
                arcView.name = "Arc " + i++;

                // Keep track of the arc in grid space
                // Since arcs are undirected, we should add the opposite direction as well
                ArcMap.Add(arc.Position, arc.Direction, arcView);
                ArcMap.Add(arc.ConnectedPosition, arc.Direction.Opposite(), arcView);
            }
        }