public int CreateTool(int place, Level.LevelTool levelTool, Level level) { // converts the LevelTool into the prefab string toolType = levelTool.GetToolType(); int val = levelTool.GetVal(); //modulate the tools int modNum = level.GetModNum(); val = Calc.ModThree(val, modNum); GameObject prefab = FindPrefab(toolType); if (prefab == null) { return(place); } GameObject g = Instantiate(prefab); g.transform.position = toolContainer.transform.position + new Vector3(0, 0, -place * 1.41f); g.transform.rotation = toolContainer.transform.rotation; g.transform.SetParent(toolContainer.transform, true); ButtonTool buttonTool = g.GetComponentInChildren <ButtonTool>(); tools[place] = buttonTool; buttonTool.SetUp(val, place, soundManager); place++; return(place); }
public void LoadTools(Level level) { Debug.Log(TAG + "loading the tools"); Level.LevelTool[] levelTools = level.GetTools(); for (int i = 0; i < 6; i++) { ToolSelect t = toolSelects[i]; Level.LevelTool levelTool = levelTools[i]; string toolType = levelTool.GetToolType(); int val = levelTool.GetVal(); if (toolType == "none") { val = 7; } t.SetVal(toolType); t.colorSelect.SetVal(val); t.colorSelect.SetColorMenu(false); t.SetToolMenu(false); } }