private void EditorUpdate() { NodeNameCanvas.worldCamera = Camera.main; NodeNameText.text = name; NodeImage.sprite = MapPrefabsConfig.Get().MapNodeIcons.Find(x => x.Type == Type)?.Icon; NeighbourNodes.Remove(this); NeighbourNodes.RemoveAll(node => node == null); NeighbourNodes = NeighbourNodes.Distinct().ToList(); }
private void Awake() { NodesList.AddRange(GetComponentsInChildren <MapNodeVisual>()); CurrentNode = NodesList.Find(node => node.Type == NodeType.StartNode); Player = Instantiate(MapPrefabsConfig.Get().MapPlayerPrefab); Player.transform.position = CurrentNode.transform.position; foreach (var node in NodesList) { node.OnNodePressed += TrySendPlayerToNode; } }