コード例 #1
0
        private void DrawMantaDebugMenu()
        {
            if (GUILayout.Button("Spawn manta"))
            {
                GameObject gameObject2 = MantaMod.CreateManta();
                manta = gameObject2.GetComponent <MantaSubmarine>();
                mantaMovementController        = gameObject2.GetComponent <MovementController>();
                gameObject2.transform.position = Camera.main.transform.position + Camera.main.transform.forward * 22f;
                gameObject2.transform.LookAt(Player.main.transform);
            }

            if (GUILayout.Button("Connect to manta on cursor"))
            {
                Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
                if (Physics.Raycast(ray, out RaycastHit hit))
                {
                    if (hit.rigidbody.gameObject.name.ToLower().Contains("manta"))
                    {
                        manta = hit.rigidbody.gameObject.GetComponent <MantaSubmarine>();
                        mantaMovementController = hit.rigidbody.gameObject.GetComponent <MovementController>();
                    }
                }
            }

            if (GUILayout.Button("Manta Count"))
            {
                MantaSubmarine[] submarines = FindObjectsOfType <MantaSubmarine>();
                Log.Print("Found " + submarines.Length + " Mantas");
            }

            if (GUILayout.Button("Delete All Mantas"))
            {
                MantaSubmarine[] submarines = FindObjectsOfType <MantaSubmarine>();
                Log.Print("Found " + submarines.Length + " Mantas to delete");
                foreach (MantaSubmarine s in submarines)
                {
                    Destroy(s.gameObject);
                }
            }

            if (GUILayout.Button("Manta render materials on raycast"))
            {
                Ray ray4 = Camera.main.ScreenPointToRay(Input.mousePosition);
                if (Physics.Raycast(ray4, out RaycastHit raycastHit4))
                {
                    if (raycastHit4.rigidbody.gameObject.name.ToLower().Contains("manta"))
                    {
                        Transform gggg1 = raycastHit4.rigidbody.gameObject.transform.Find("Model").transform.Find("Exterior");
                        Log.Print("Materials count: " + gggg1.GetComponent <MeshRenderer>().materials.Length);
                        foreach (Material mat in gggg1.GetComponent <MeshRenderer>().materials)
                        {
                            if (mat.name.ToLower().Contains("glass"))
                            {
                                mat.PrintAllMarmosetUBERShaderProperties();
                            }
                        }
                    }
                }
            }

            if (manta == null)
            {
                GUILayout.Box("No Manta Connected");
                return;
            }

            GUILayout.Box("Current Health: " + manta.GetComponent <LiveMixin>()?.health);
            GUILayout.Box("Max Health: " + manta.GetComponent <LiveMixin>()?.maxHealth);
            GUILayout.Box("Health Per Damage Point: " + manta.GetComponent <ExternalDamageManager>().GetHealthPerDamagePoint());
            GUILayout.Box("Unused Damage Point: " + manta.GetComponent <ExternalDamageManager>().GetUnusedDamagePointsCount());
            GUILayout.Box("Used Damage Point: " + manta.GetComponent <ExternalDamageManager>().GetUsedDamagePointsCount());
            GUILayout.Box("Amount of Damage Points that *should* be showing: " + manta.GetComponent <ExternalDamageManager>().GetNumberOfDamagePointsThatShouldBeShowing());

            if (GUILayout.Button("Toggle Emergency Lighting"))
            {
                if (manta.GetComponent <EmergencyLighting>().IsRunning)
                {
                    manta.GetComponent <EmergencyLighting>().DisableEmergencyLighting();
                }
                else
                {
                    manta.GetComponent <EmergencyLighting>().EnableEmergencyLighting();
                }
            }
        }