Esempio n. 1
0
 public static void DestroyDummy(DummyCharacter dummy)
 {
     if (ActiveDummies.Contains(dummy))
     {
         ActiveDummies.Remove(dummy);
     }
     if (dummy.CharacterExists)
     {
         dummy.DestroyCharacter();
     }
 }
Esempio n. 2
0
        public static DummyCharacter AddDummy(string name)
        {
            var dummy = new DummyCharacter
            {
                Name   = name,
                Config = new DummyConfig()
            };

            ActiveDummies.Add(dummy);

            dummy.SpawnOrReset();

            return(dummy);
        }
Esempio n. 3
0
        private void InspectPage(bool inmenu)
        {
            if (m_dummyCharacter == null)
            {
                m_windowPage = 0;
            }
            else
            {
                AIButtons();

                if (!m_dummyCharacter.CharacterExists)
                {
                    if (inmenu)
                    {
                        m_windowPage = 0;
                    }

                    GUILayout.Label("Character has despawned...");
                }
                else
                {
                    EditInspectingDummy();
                }

                GUI.color = Color.green;
                if (GUILayout.Button("Spawn / Apply"))
                {
                    m_dummyCharacter.SpawnOrReset();
                }

                GUILayout.Space(10);

                GUI.color = Color.red;
                if (GUILayout.Button("Destroy Dummy"))
                {
                    CombatDummyMod.DestroyDummy(m_dummyCharacter);
                    m_dummyCharacter = null;
                    m_windowPage     = 0;
                }
                GUI.color = Color.white;
            }
        }
Esempio n. 4
0
        public static DummyCharacter AddDummy(string name)
        {
            var dummy = new DummyCharacter
            {
                Name     = name,
                Template = new SL_Character()
                {
                    Name      = name,
                    UID       = $"com.sinai.CombatDummy.{name}",
                    Faction   = Character.Factions.Bandits,
                    AI        = new SL_CharacterAIMelee(),
                    Weapon_ID = 2000010,
                }
            };

            ActiveDummies.Add(dummy);

            dummy.SpawnOrReset();

            return(dummy);
        }
Esempio n. 5
0
        private void WindowFunction(int id)
        {
            GUI.DragWindow(new Rect(60, 0, m_rect.width - 90, 20));

            if (m_windowPage != 0)
            {
                if (GUI.Button(new Rect(3, 3, 55, 20), "< Home"))
                {
                    m_dummyCharacter = null;
                    m_windowPage     = 0;
                    return;
                }
            }
            if (GUI.Button(new Rect(m_rect.width - 33, 2, 30, 20), "X"))
            {
                ShowMenu = !ShowMenu;
            }

            GUILayout.BeginArea(new Rect(3, 25, m_rect.width - 6, m_rect.height - 30), GUI.skin.box);

            m_scroll = GUILayout.BeginScrollView(m_scroll);

            var inmenu = !NetworkLevelLoader.Instance.AllPlayerDoneLoading || SceneManagerHelper.ActiveSceneName.ToLower().Contains("mainmenu");

            if (m_windowPage == 0)
            {
                MainPage(inmenu);
            }
            else
            {
                InspectPage(inmenu);
            }

            GUILayout.EndScrollView();

            GUILayout.EndArea();
        }
Esempio n. 6
0
        private void MainPage(bool inmenu)
        {
            if (!inmenu)
            {
                BoldTitle("Spawn new dummy");

                GUILayout.BeginHorizontal();

                GUILayout.Label("Dummy name:", GUILayout.Width(120));
                m_newDummyName = GUILayout.TextField(m_newDummyName, GUILayout.Width(120));
                if (GUILayout.Button("Add", GUILayout.Width(40)))
                {
                    if (string.IsNullOrEmpty(m_newDummyName))
                    {
                        m_newDummyName = "Dummy " + CombatDummyMod.ActiveDummies.Count + 1;
                    }
                    var dummy = CombatDummyMod.AddDummy(m_newDummyName);
                    m_dummyCharacter = dummy;
                    m_windowPage     = 1;

                    m_newDummyName = $"Dummy {CombatDummyMod.ActiveDummies.Count + 1}";
                }

                GUILayout.EndHorizontal();

                GUILayout.Space(5);

                BoldTitle("Active Dummies:");

                var list = CombatDummyMod.ActiveDummies;

                if (list.Count < 1)
                {
                    GUILayout.Label("Spawn a dummy to start...");
                }
                else
                {
                    for (int i = 0; i < list.Count; i++)
                    {
                        GUILayout.BeginHorizontal();
                        var dummy = list[i];
                        if (GUILayout.Button(dummy.Name))
                        {
                            m_dummyCharacter = dummy;
                            m_windowPage     = 1;
                        }
                        GUILayout.Label("AI:", GUILayout.Width(20));
                        GUI.color = Color.green;
                        if (GUILayout.Button("Enable", GUILayout.Width(60)))
                        {
                            dummy.SetAIEnabled(true);
                        }
                        GUI.color = Color.red;
                        if (GUILayout.Button("Disable", GUILayout.Width(60)))
                        {
                            dummy.SetAIEnabled(false);
                        }
                        GUI.color = Color.white;
                        GUILayout.EndHorizontal();
                    }
                }
            }
            else
            {
                GUILayout.Label("Load up a character to start...");
            }
        }