Beispiel #1
0
    public int SetUp(Level level)
    {
        Debug.Log(TAG + "Setting up.");

        //position the tool container at the edge of the screen
        Vector3 v = toolContainer.transform.position;

        toolContainer.transform.position = c.ScreenToWorldPoint(new Vector3(Screen.width, Screen.height, v.z)) - new Vector3(1.2f, 0, 1.2f);

        tools = new ButtonTool[6];
        Level.LevelTool[] t = level.GetTools();
        t = ScrambleTools(t);

        int place = 0;

        for (int i = 0; i < 6; i++)
        {
            Level.LevelTool levelTool = t[i];

            place = CreateTool(place, levelTool, level);
        }
        //returns the number of active tools for this level
        //used for calculating when the tutorial msg should be displayed
        return(place);
    }
Beispiel #2
0
    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);
    }
Beispiel #3
0
    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);
        }
    }