//iterate through all entities that have correct components void Iterate(int entityId, ECS_Entity thisEntity) { thisCycle = thisEntity.lSysFacComp.CycleStep; if (thisEntity.lSysFacComp.CycleStep >= thisEntity.lSysFacComp.MaxCycle) { thisEntity.lSysComp.NeedsDrawing = false; thisEntity.lSysFacComp.IsDrawing = false; return; } thisInstruction = InstantiateInstructionInList(thisEntity, thisEntity.lSysFacComp.InstructionList, thisCycle); RandomiseThisInstruction(thisInstruction); Debug.Log("thisCycle : " + thisCycle); Debug.Log("This String : " + thisEntity.lSysComp.DNA[thisEntity.lSysComp.DNA.Count - 1].ToString()); //Debug.Log ("DNA Length : " + thisEntity.lSysComp.DNA.Length); switchString = thisEntity.lSysComp.DNA[thisEntity.lSysComp.DNA.Count - 1][thisCycle].ToString(); switch (switchString) { case ">": thisInstruction.Angle += thisInstruction.AngleChange; break; case "<": thisInstruction.Angle -= thisInstruction.AngleChange; break; case "F": Vector2 debugpos = (AngleHelper.Vector2FromAngle(thisInstruction.Angle).normalized *thisInstruction.Length); //Debug.Log ("vector change: " + debugpos); thisInstruction.position += debugpos; break; case "+": thisInstruction.AngleChange += 5f; break; case "-": thisInstruction.AngleChange -= 5f; break; case "[": thisEntity.lSysFacComp.InstructionStack.Push(Instantiate(thisInstruction)); break; case "]": thisEntity.lSysFacComp.InstructionList[thisCycle] = thisEntity.lSysFacComp.InstructionStack.Pop(); break; case "O": thisInstruction.Size *= 1.2f; break; case "o": thisInstruction.Size *= 0.8f; break; case "A": if (thisEntity.lSysFacComp.FactoryPrefabs_A != null) { thisSpawn = (GameObject)Instantiate(thisEntity.lSysFacComp.FactoryPrefabs_A, new Vector3(thisInstruction.position.x, thisInstruction.position.y), Quaternion.identity, thisEntity.trans); thisEntity.lSysFacComp.Children.Add(thisSpawn); PaintGameObject(thisSpawn, thisInstruction); } break; case "B": if (thisEntity.lSysFacComp.FactoryPrefabs_B != null) { thisSpawn = (GameObject)Instantiate(thisEntity.lSysFacComp.FactoryPrefabs_B, new Vector3(thisInstruction.position.x, thisInstruction.position.y), Quaternion.identity, thisEntity.trans); thisEntity.lSysFacComp.Children.Add(thisSpawn); PaintGameObject(thisSpawn, thisInstruction); } break; case "C": if (thisEntity.lSysFacComp.FactoryPrefabs_A != null) { thisSpawn = (GameObject)Instantiate(thisEntity.lSysFacComp.FactoryPrefabs_A, new Vector3(thisInstruction.position.x, thisInstruction.position.y), Quaternion.identity, thisEntity.trans); thisEntity.lSysFacComp.Children.Add(thisSpawn); PaintGameObject(thisSpawn, thisInstruction); } break; break; } thisEntity.lSysFacComp.CycleStep += 1; }