Esempio n. 1
0
        /// <summary>
        /// Displays a CrowdGroup group on the GUI
        /// </summary>
        /// <param name="group">The group to be displayed</param>
        public void ShowGroup(CrowdGroup group)
        {
            GUILayout.Label("Group Name: ");

            group.GroupName = GUILayout.TextField(group.GroupName);

            GUILayout.BeginHorizontal();

            GUILayout.Label("Number of Models: ");
            _numberOfModels = EditorGUILayout.IntField(_numberOfModels, GUILayout.Width(100));
            GUILayout.EndHorizontal();

            for (int i = 0; i < _numberOfModels; i++)
            {
                GUILayout.Label("Crowd Character " + i);

                //characters[characters.Count - 1], typeof(GameObject), true, GUILayout.Width(200))
                //for (int j = 0; j < _crowdController._LODCount; j++)
                //{
                //    GUILayout.BeginHorizontal();
                //    GUILayout.Label("Level of Detail Object " + j);
                //    levelsOfDetail[i] = (GameObject)EditorGUILayout.ObjectField(levelsOfDetail[i], typeof(GameObject), true, GUILayout.Width(200));
                //    GUILayout.EndHorizontal();
                //}
            }

            if (GUILayout.Button("Delete This Group", GUILayout.Width(200)))
            {
                _crowdController.RemoveGroup(group.GroupName);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// GUI loop
        /// </summary>
        void OnGUI()
        {
            if (_crowdController != null)
            {
                _currentGroups   = _crowdController.GetGroups();
                _unassignedGroup = _crowdController.GetUnassignedGroup;


                GUILayout.Label("Add New Group", _headingTextStyle);

                GUILayout.BeginHorizontal();
                GUILayout.Label("Group Name:", _genericTextStyle, GUILayout.Width(120));

                _newGroupName = GUILayout.TextField(_newGroupName, 25, GUILayout.Width(200));
                GUILayout.EndHorizontal();

                if (GUILayout.Button("Add New Group", GUILayout.Width(200)))
                {
                    if (_newGroupName != "Group Name")
                    {
                        Debug.Log("Tried to talk to controller");
                        _crowdController.AddGroup(_newGroupName);
                    }
                }



                EditorGUILayout.LabelField("", GUI.skin.horizontalSlider);


                scrollPosition = GUILayout.BeginScrollView(scrollPosition);

                if (_unassignedGroup != null)
                {
                    ShowGroup(_unassignedGroup);
                }

                if (_currentGroups != null)
                {
                    for (int i = 0; i < _currentGroups.Length; i++)
                    {
                        ShowGroup(_currentGroups[i]);
                    }
                }

                GUILayout.EndScrollView();
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Instantiates classes inside of the controller
        /// This will cause the controller to lose all references to objects
        /// </summary>
        public void SetUp()
        {
            _scene = SceneManager.GetActiveScene().name;


            if (_instance != null)
            {
                if (_instance != this && _instance.ControllerScene == _scene)
                {
                    Debug.LogWarning("Can Only Have one Crowd Controller per scene");
                    Destroy(gameObject);
                    return;
                }
            }
            print("set up");
            _instance = this;

            _crowdGroups     = new List <CrowdGroup>();
            _groupUnassigned = new CrowdGroup("Unassigned");
            _crowdSources    = new List <GameObject>();

            _setUp = true;
        }