Beispiel #1
0
 public void LoadConnection(Model.Connection.Connection connection, ConnectionDistributionService distributionService)
 {
     if (connection == null || graph.ConnectionObjectMap.ContainsKey(connection))
     {
         return;
     }
     InitConnection(connection, distributionService);
     controller.OnConnectionLoaded?.Invoke(connection);
 }
Beispiel #2
0
        private void InitConnection(Model.Connection.Connection connection, ConnectionDistributionService distributionService)
        {
            if (!(Connected(connection.Item1, connection.Item2) || Connected(connection.Item2, connection.Item1)) && controller.NetworkController.IsServer())
            {
                logger.Warning("Attempting to create connection that does not exist");
            }

            GameObject connectionObject = controller.Connections.Pool.Spawn();
            Node       otherNode        = connection.OtherEnd(distributionService.CentralNode);

            distributionService.GenerateRoute(connection, otherNode);
            var centerNode = graph.NodeObjectMap[distributionService.CentralNode];

            InitConnectionObject(ref connectionObject, centerNode,
                                 graph.NodeObjectMap[otherNode], GetConnectionLineColor(connection));
            graph.ConnectionObjectMap.Add(connection, connectionObject);
            StartConnectionAnimation(connection, AnimationDirection.OUT);

            if (distributionService.CentralNode == controller.NodeController.SelectedNode)
            {
                GameObject conNode = controller.NodeController.NodeLoadManager.LoadConnectionNode(otherNode, centerNode.transform.position + connection.ConnectionRoute.SpherePoint);
                graph.ConnectionNodes.Add(connection, conNode);
            }
        }