protected virtual void Awake() { GM = GameObject.FindGameObjectWithTag("GM").GetComponent <GameManager>(); Canvas = GameObject.Find("Canvas"); ChildrenGetter = GetComponent <FindChildrenWithTag>(); LevelText = ChildrenGetter.GetChildWithName(Canvas.transform, "LevelText"); Score = ChildrenGetter.GetChildWithName(Canvas.transform, "Score").GetComponent <TextMeshProUGUI>(); ScoreText = ChildrenGetter.GetChildWithName(Canvas.transform, "Sc0reText").GetComponent <TextMeshProUGUI>(); ComboCounter = ChildrenGetter.GetChildWithName(Canvas.transform, "ComboCounter").GetComponent <TextMeshProUGUI>(); healthBar = GameObject.FindGameObjectWithTag("HealthBar").GetComponent <Image>(); PlayerController player = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerController>(); MaxHealth = player.MaxHealth; Key = ChildrenGetter.GetChildWithName(Canvas.transform, "Key"); gameOverScreen = ChildrenGetter.GetChildWithName(Canvas.transform, "GameOverScreen"); BossHealthBar = ChildrenGetter.GetChildWithName(Canvas.transform, "BossHealthBar").GetComponent <Image>(); BossMaxHealth = 500f; if (GM.health == 0) { SetHealth(250); } else { SetHealth(GM.health); } if (GM.combo != 0) { SetCombo(GM.combo); } UpdateScore(GM.score); }
/// <summary> /// Invalidates the sub-items of this tree view model item internally, without updating the UI. /// </summary> private void InvalidateChildrenInternal() { foreach (var item in FirstLevelItems) { item.TearDown(); } firstLevelItems.Clear(); foreach (var item in (ChildrenGetter?.Invoke(Value) ?? Enumerable.Empty <ITreeViewModelItem>())) { item.Initialize(Owner, this); firstLevelItems.Add(item); } }
public DepthFirstSearch(IEnumerable <T> nodes, ChildrenGetter <T> childrenGetter) { CodeContract.RequiresArgumentNotNull(nodes, "nodes"); CodeContract.RequiresArgumentNotNull(childrenGetter, "childrenGetter"); m_nodes = nodes.ToArray(); m_childrenGetter = childrenGetter; m_visited = new bool[m_nodes.Length]; m_nodesInfo = new DFSInfo[m_nodes.Length]; m_nodeIndexLookup = new Dictionary <T, int>(); for (int i = 0; i < m_nodes.Length; i++) { m_nodeIndexLookup[m_nodes[i]] = i; } }