예제 #1
0
    public static SCR_option CreateOption(string optionName, Vector2 pos)
    {
        GameObject optionInst = Instantiate(Resources.Load(("Objects/Gui/_Option/Option_" + optionName), typeof(GameObject)), new Vector3(pos.x, pos.y, 10f), Quaternion.identity) as GameObject;
        SCR_option option     = optionInst.GetComponent <SCR_option>();

        return(option);
    }
예제 #2
0
    public static void OptionCycle(int com)
    {
        GameObject[] options = GameObject.FindGameObjectsWithTag("Option");

        foreach (GameObject option in options)
        {
            if (option.GetComponent <SCR_option>())
            {
                SCR_option o = option.GetComponent <SCR_option>();

                int action = 0;

                if (com == 0)
                {
                    action = o.Highlight(0, mousePos);

                    if (action == 1)
                    {
                        if (SND_highlight)
                        {
                            SND_highlight.PlaySound();
                        }
                    }
                }
                if (com == 1)
                {
                    action = o.Highlight(1, mousePos);

                    if (action == 2 || action == 3)
                    {
                        if (SND_select)
                        {
                            SND_select.PlaySound();
                        }
                        if (action == 2)
                        {
                            rightClickAction = -1;
                        }
                    }
                }
                if (com == 2)
                {
                    o.OptionEvent(0);
                }
                if (com == 3)
                {
                    o.Kill();
                }
                if (com == 4)
                {
                    o.OptionEvent(1);
                }
            }
        }
    }