示例#1
0
        static public string EnableTempRaycast(ControllerAction action, GameObject dialog)
        {
            string action_name = "TempRaycast" + action_num;

            action_num++;

            /* disable all other actions, on this controller */
            BaroqueUI_Controller ctrl = action.controller;
            var disabled = new ArrayList();

            foreach (var act in ctrl.GetComponentsInChildren <ControllerAction>())
            {
                if (!act.isActiveAndEnabled)
                {
                    continue;
                }
                if (act.gameObject == ctrl.gameObject)
                {
                    disabled.Add(act);
                    act.enabled = false;
                }
                else
                {
                    disabled.Add(act.gameObject);
                    act.gameObject.SetActive(false);
                }
            }

            /* add a TempTaycastAction */
            TempRaycastAction temp_act = ctrl.gameObject.AddComponent <TempRaycastAction>();

            temp_act.Reset();
            temp_act.t_disabled = disabled;
            temp_act.actionName = action_name;
            temp_act.dialog     = dialog;

            return(action_name);
        }
示例#2
0
        static public void DisableTempRaycast(ControllerAction action, string action_name)
        {
            BaroqueUI_Controller ctrl = action.controller;

            foreach (var temp_act in ctrl.GetComponents <TempRaycastAction>())
            {
                if (temp_act.actionName == action_name)
                {
                    foreach (var go in temp_act.t_disabled)
                    {
                        if (go is GameObject)
                        {
                            (go as GameObject).SetActive(true);
                        }
                        else
                        {
                            (go as ControllerAction).enabled = true;
                        }
                    }
                    temp_act.enabled = false;
                    Destroy(temp_act);
                }
            }
        }