public void OutputUpdate() { try { tm = GameObject.FindGameObjectWithTag("GameController").GetComponent <TuringMachine>(); index = int.Parse(GameObject.FindGameObjectWithTag("stateDisplay").GetComponent <TextMesh>().text); input = GameObject.FindGameObjectWithTag("readDisplay").GetComponent <TextMesh>().text; if (input.Equals("")) { df = tm.StateByIndex(index).LookForFunction('Ø'); } else { df = tm.StateByIndex(index).LookForFunction(char.Parse(input)); } if (df.getOutput().Equals('Ø')) { GetComponent <TextMesh>().text = ""; } else { GetComponent <TextMesh>().text = df.getOutput() + ""; } } catch { } }
public ArrayList ProcessCell(State state, int index) { ArrayList whatReturn = new ArrayList(); GameObject cellTape = GameObject.FindGameObjectWithTag("actualCell"); if (state.HaveFunctions()) { if (cellTape != null) { DeltaFunction df = state.LookForFunction(char.Parse(cellTape.GetComponent <TextMesh>().text)); if (df != null) { index = df.getNextState(); Utils.WriteOnDisplay("stateDisplay", index + ""); if (df.getOutput() == 'v') { try { Destroy(cellTape); } catch { } } else { cellTape.GetComponent <TextMesh>().text = df.getOutput() + ""; } if (currentMoveMachineCoroutine != null) { StopCoroutine(currentMoveMachineCoroutine); } currentMoveMachineCoroutine = MoveMachine(df.getSide(), GameObject.FindGameObjectWithTag("TuringMachine").transform.position); StartCoroutine(currentMoveMachineCoroutine); whatReturn.Add(true); whatReturn.Add(index); return(whatReturn); } } else { DeltaFunction df = state.LookForFunction('v'); if (df != null) { index = df.getNextState(); Utils.WriteOnDisplay("stateDisplay", index + ""); if (df.getOutput() == 'v') { try { Destroy(cellTape); } catch { } if (currentMoveMachineCoroutine != null) { StopCoroutine(currentMoveMachineCoroutine); } currentMoveMachineCoroutine = MoveMachine(df.getSide(), GameObject.FindGameObjectWithTag("TuringMachine").transform.position); StartCoroutine(currentMoveMachineCoroutine); whatReturn.Add(true); whatReturn.Add(index); return(whatReturn); } else { Utils.InstantiateCell(df.getOutput(), cellTapePrefab); if (currentMoveMachineCoroutine != null) { StopCoroutine(currentMoveMachineCoroutine); } currentMoveMachineCoroutine = MoveMachine(df.getSide(), GameObject.FindGameObjectWithTag("TuringMachine").transform.position); StartCoroutine(currentMoveMachineCoroutine); whatReturn.Add(true); whatReturn.Add(index); return(whatReturn); } } else { whatReturn.Add(false); whatReturn.Add(index); return(whatReturn); } } } whatReturn.Add(false); whatReturn.Add(index); return(whatReturn); }