public void InsertAtLine(CodeLine lineToInsert, int index, CodeLine parentLine) { GameObject parentGameObject; if (parentLine == null) { parentGameObject = RootContainer; } else { parentLine.TemporaryCodeLine = null; parentGameObject = parentLine.instruction; } lineToInsert.SetParent(parentLine, index); lineToInsert.container.transform.SetParent(parentGameObject.transform); int parentLineIndex = parentLine == null ? 0 : parentLine.InstructionIndex; if (parentLine == null) { Solution.Insert(index + parentLineIndex, lineToInsert); } lineToInsert.container.transform.SetSiblingIndex(index); lineToInsert.instruction.GetComponent <CanvasGroup>().blocksRaycasts = true; lineToInsert.container.GetComponent <CanvasGroup>().blocksRaycasts = true; //Rearrange(); }
public void Unpin(CodeLine codeLine) { unpinnedCodeline = codeLine; codeLine.SetParent(null); RemoveCodeLineFromSolution(codeLine); codeLine.container.transform.SetParent(UnpinnedCodeLineParentTransform); codeLine.instruction.transform.SetParent(codeLine.container.transform); }
public void RemoveCodeLineFromSolution(CodeLine codeLine) { Solution.Remove(codeLine); codeLine.SetParent(null); }