void SetGraph(EventGraph newGraph) { //On le met vrm a null pour ne pas faire d'erreur avec les Object detruit if (graph == null) { graph = null; } //Remove previous listeners if (graph != null) { graph.onEventsAddedOrRemoved -= RebuildItems; } //Assign new graph graph = newGraph; if (graph == null) { ClearItems(); } else { graph.onEventsAddedOrRemoved += RebuildItems; RebuildItems(); } }
public bool LinkToGraph() { if (!Application.isPlaying) { Scene scene = SceneManager.GetActiveScene(); if (scene.isLoaded) { graph = scene.FindRootObject <EventGraph>(); if (graph != null) { if (!graph.ContainsEvent(this)) { graph.AddEvent(this); } return(true); } else { Debug.LogError("No EventGraph component on root objects. Removing PhysicalEvent component."); DestroyImmediate(this); } } } return(false); }
void SetScene(Scene scene) { EventGraph newGraph = scene.FindRootObject <EventGraph>(); if (newGraph == null) { Debug.Log("Il n'y a pas de EventGraph dans la scène " + scene.name + ". (Il doit être sur un gameobject racine)"); } SetGraph(newGraph); }
public bool LinkToGraph() { if (!Application.isPlaying) { Scene scene = SceneManager.GetActiveScene(); if (scene.isLoaded) { graph = scene.FindRootObject <EventGraph>(); if (graph != null) { if (!graph.ContainsEvent(this)) { graph.AddEvent(this); } return(true); } else { Debug.LogError("Il doit y avoir un component EventGraph sur un des gameobjects racine."); } } } return(false); }