private void UnlightPath(int idCall) { Call call = null; foreach (Call c in callsInTransmission) { if (c.id == idCall) { call = c; } } if (call != null && call.status == Call.Status.inCall) { foreach (Transform edgeTransform in ListeEdgesMenu.transform) { EdgeController edge = edgeTransform.GetComponent <EdgeController>(); if (edge.gameObject.activeSelf) { if (edge.idMessage == call.id) { edge.TakePath(-1); } } } foreach (Transform edgeTransform in ListeEdges.transform) { EdgeController edge = edgeTransform.GetComponent <EdgeController>(); if (edge.gameObject.activeSelf) { if (edge.idMessage == call.id) { edge.TakePath(-1); } } } /*NodeController actualNode = call.caller; * * //chercher prochain node * int iter=0; * while(actualNode!=call.reciever && iter<100){ * iter++; * foreach(EdgeController edge in actualNode.neighborhoodList){ * if(edge.idMessage == call.id){ * edge.TakePath(-1); * actualNode = edge.KnowOtherSide(actualNode); * * } * } * }*/ } }
public void AddNodeToTrajectory(NodeController node) { //vérifier que le node n'a jamais été ajouté, et qu'une trajectoire est en cours if (actualTrajectory.Count > 0 && /*!actualTrajectory.Contains(node)*/ !isAlreadyUsed(node, actualTrajectory[actualTrajectory.Count - 1], actualTrajectory[0].call.id)) //todo à changer { //vérifier si on respecte les edges if (node.IsConnectedTo(actualTrajectory[actualTrajectory.Count - 1])) { actualTrajectory.Add(node); soundManager.PlaySound(SoundManager.SoundList.LINK_NODE, false); Debug.Log("Add " + node.name); Call call = null; foreach (Call c in callsInTransmission) { if (c.caller == actualTrajectory[0] || c.reciever == actualTrajectory[0]) { call = c; } } EdgeController actualEdge = node.edge(actualTrajectory[actualTrajectory.Count - 2]); if (actualEdge.IsTaken()) { alreadyUsedEdges.Add(actualEdge); idUsedEdges.Add(actualEdge.idMessage); } //changer couleur du edge en question //node.edge(actualTrajectory[actualTrajectory.Count - 2]).ChangeColor(new Color(1,0,0)); actualEdge.TakePath(call.id); //si c'est un node obligatoire, alors il devient "utilisé" if (call.node_obligatory == node) { node.isUsed = true; } } } }