public void PopTopElement() { GameObjectStack stack = FindStack(); if (stack == null) { return; } if (all) { while (stack.stack.Count > 0) { stack.PopTopElement(); } } else { stack.PopTopElement(); } }
public void HandleCloseButtonClicked() { GameObjectStackElement element = GetComponentInParent <GameObjectStackElement>(); GameObjectStack stack = element.GetComponentInParent <GameObjectStack>(); if (stack.stack.Count > 0 && stack.stack[stack.stack.Count - 1] == element) { stack.PopTopElement(); if (onCloseClicked != null) { onCloseClicked.Invoke(); } } }
public void PushElement() { GameObjectStack stack = FindStack(); if (stack == null) { return; } if (popFirst) { stack.PopTopElement(); } stack.SpawnObject(prefab); }