{"id":66,"date":"2025-03-27T23:57:17","date_gmt":"2025-03-27T15:57:17","guid":{"rendered":"https:\/\/www.wunen.com\/index.php\/2025\/03\/27\/unity-%e7%ac%ac%e4%b8%80%e4%ba%ba%e7%a7%b0%e5%b0%84%e5%87%bb%e6%b8%b8%e6%88%8f\/"},"modified":"2025-03-27T23:57:17","modified_gmt":"2025-03-27T15:57:17","slug":"unity-%e7%ac%ac%e4%b8%80%e4%ba%ba%e7%a7%b0%e5%b0%84%e5%87%bb%e6%b8%b8%e6%88%8f","status":"publish","type":"post","link":"http:\/\/www.wunen.com\/index.php\/2025\/03\/27\/unity-%e7%ac%ac%e4%b8%80%e4%ba%ba%e7%a7%b0%e5%b0%84%e5%87%bb%e6%b8%b8%e6%88%8f\/","title":{"rendered":"Unity\u2014\u2014\u7b2c\u4e00\u4eba\u79f0\u5c04\u51fb\u6e38\u620f"},"content":{"rendered":"<div class=\"article_content clearfix\" id=\"article_content\">\n <link href=\"https:\/\/csdnimg.cn\/release\/blogv2\/dist\/mdeditor\/css\/editerView\/kdoc_html_views-1a98987dfd.css\" rel=\"stylesheet\"\/>\n <link href=\"https:\/\/csdnimg.cn\/release\/blogv2\/dist\/mdeditor\/css\/editerView\/ck_htmledit_views-704d5b9767.css\" rel=\"stylesheet\"\/>\n<div class=\"htmledit_views\" id=\"content_views\">\n<h2>\n   \u524d\u8a00<br \/>\n  <\/h2>\n<p>\n   \u5728\u8be5\u6e38\u620f\u4e2d\uff0c\u73a9\u5bb6\u5c06\u64cd\u63a7\u4e00\u4e2a\u643a\u5e26\u5f13\u5f29\u7684\u89d2\u8272\uff0c\u5728\u6709\u9650\u7684\u65f6\u95f4\u5185\u5c3d\u91cf\u83b7\u5f97\u66f4\u591a\u7684\u79ef\u5206\uff0c\u79ef\u5206\u53ef\u4ee5\u901a\u8fc7\u5c04\u4e2d\u9776\u5b50\u83b7\u5f97\uff0c\u9776\u5b50\u6709\u9759\u6b62\u9776\u548c\u79fb\u52a8\u9776\uff0c\u4e0d\u540c\u9776\u5b50\u5f97\u5206\u4e0d\u540c\u3002\u73a9\u5bb6\u5fc5\u987b\u8981\u8fdb\u5165\u6307\u5b9a\u7684\u5c04\u51fb\u533a\u5185\u624d\u53ef\u4ee5\u8fdb\u884c\u5c04\u51fb\uff0c\u5c04\u51fb\u533a\u7684\u5c04\u51fb\u6570\u6709\u9650\u3002\n  <\/p>\n<p>\n   <a class=\"link-info\" href=\"https:\/\/gitee.com\/llllllzj\/3dhw\" rel=\"nofollow\" title=\"\u9879\u76ee\u5730\u5740\"><br \/>\n    \u9879\u76ee\u5730\u5740<br \/>\n   <\/a>\n  <\/p>\n<p>\n   <a class=\"link-info\" href=\"https:\/\/www.bilibili.com\/video\/BV17qqNYCEcE\/?spm_id_from=333.999.list.card_archive.click&amp;vd_source=22fe0a07c38e0c84fe6c6c78a792ff18\" rel=\"nofollow\" title=\"\u89c6\u9891\u5730\u5740\"><br \/>\n    \u89c6\u9891\u5730\u5740<br \/>\n   <\/a>\n  <\/p>\n<h2>\n   \u4e00\u3001\u5236\u4f5c\u89d2\u8272player<br \/>\n  <\/h2>\n<p>\n   \u4f7f\u7528\u4e00\u4e2aCapsule\u80f6\u56ca\u4f53\u6765\u4f5c\u4e3a\u89d2\u8272\u7684\u8eab\u4f53\uff0c\u5e76\u628a\u5f13\u548c\u4e00\u4e2a\u6444\u50cf\u673a\u4f5c\u4e3a\u80f6\u56ca\u4f53\u7684\u5b50\u5bf9\u8c61\uff0c\u8c03\u6574\u6444\u50cf\u673a\u548c\u5f13\u7684\u4f4d\u7f6e\u4f7f\u5f97\u753b\u9762\u5408\u7406\u3002\n  <\/p>\n<\/p>\n<h2>\n   \u4e8c\u3001\u89d2\u8272\u63a7\u5236<br \/>\n  <\/h2>\n<h3>\n   1.MouseLook\u89c6\u89d2\u63a7\u5236<br \/>\n  <\/h3>\n<p>\n   \u8be5\u811a\u672c\u6302\u5728\u5728\u6444\u50cf\u673a\u4e0e\u5f13\u4e0a\uff0c\u4f7f\u5f97\u89c6\u89d2\u80fd\u591f\u968f\u9f20\u6807\u7684\u8fd0\u52a8\u800c\u8f6c\u52a8\u3002\n  <\/p>\n<pre><code class=\"language-cs\">using System.Collections;\nusing System.Collections.Generic;\nusing UnityEngine;\n\npublic class MouseLook : MonoBehaviour\n{\n    \/\/ Start is called before the first frame update\n\n    public float mouseSensitivity = 100f;  \/\/\u9f20\u6807\u7075\u654f\u5ea6\n\n    public Transform playerBody;\n\n    float xRotation = 0f;\n\n    void Start()\n    {\n        Cursor.lockState = CursorLockMode.Locked;\n    }\n\n    \/\/ Update is called once per frame\n    void Update()\n    {\n        float mouseX = Input.GetAxis(\"Mouse X\") * mouseSensitivity * Time.deltaTime;\n        float mouseY = Input.GetAxis(\"Mouse Y\") * mouseSensitivity * Time.deltaTime;\n\n        xRotation -= mouseY;\n        xRotation = Mathf.Clamp(xRotation, -90f, 90f);\/\/ limit the angle\n\n        \/\/ rotate the camera within Y axis\n        transform.localRotation = Quaternion.Euler(xRotation, 0f, 0f);\n        \/\/ rotate the player within X axis\n        playerBody.Rotate(Vector3.up * mouseX);\n    }\n}\n\n<\/code><\/pre>\n<h3>\n   2.PlayerMovement\u89d2\u8272\u79fb\u52a8<br \/>\n  <\/h3>\n<p>\n   \u8be5\u811a\u672c\u5b9e\u73b0\u4e86\u901a\u8fc7WASD\u6765\u64cd\u4f5c\u89d2\u8272\u79fb\u52a8\n  <\/p>\n<pre><code class=\"language-cs\">using System.Collections;\nusing System.Collections.Generic;\nusing UnityEngine;\nusing UnityEngine.Scripting.APIUpdating;\n\npublic class PlayerMovement : MonoBehaviour\n{   \n    public CharacterController controller;\n    public float speed = 12f;\n    private float gravity = 9.8f;\n    \/\/ Start is called before the first frame update\n\n    Vector3 move;\n    void Start()\n    {\n        \n    }\n\n    \/\/ Update is called once per frame\n    void Update()\n    {   \n        \n        if(controller.isGrounded){\n\n        float x = Input.GetAxis(\"Horizontal\");\n        float z = Input.GetAxis(\"Vertical\");\n\n        \/\/Vector3 move = new Vector3(x, 0f, z);\/\/ \u00d7 global movement, we dont want\n        move = transform.right * x + transform.forward * z;\/\/ move along the local coordinates right and forward\n\n        }\n        move.y = move.y - gravity*Time.deltaTime;\n        controller.Move(move * speed * Time.deltaTime);\n    }\n    \n}\n\n<\/code><\/pre>\n<\/p>\n<h2>\n   \u4e09\u3001Terrain\u5730\u5f62\u5236\u4f5c<br \/>\n  <\/h2>\n<p>\n   \u521b\u5efa\u4e00\u4e2aTerrain\u5730\u5f62\uff0c\u4f7f\u7528\u4e0b\u8f7d\u7684\u8d44\u6e90\u5c06\u5730\u5f62\u67d3\u7eff\uff0c\u7136\u540e\u7528\u9ec4\u8272\u7684\u5730\u5f62\u5237\u5b50\u5237\u51fa\u9ec4\u8272\u7684\u9053\u8def\uff0c\u518d\u5f80\u4e0a\u9762\u52a0\u4e00\u4e9b\u82b1\u8349\u3001\u6811\u6728\u3001\u623f\u5b50\u3001\u5c71\u8fdb\u884c\u88c5\u9970\uff0c\u4fbf\u80fd\u505a\u51fa\u4e00\u5757\u7b80\u5355\u7684\u5730\u5f62\u3002\n  <\/p>\n<h2>\n   \u56db\u3001\u5b9e\u73b0\u5929\u7a7a\u76d2\u5207\u6362SkyboxSwitcher<br \/>\n  <\/h2>\n<p>\n   \u7528\u4e00\u4e2a\u6570\u7ec4skyboxMaterials\u5b58\u50a8\u591a\u4e2a\u5929\u7a7a\u76d2\u6750\u8d28\uff0c\u5e76\u5728\u6309\u4e0bQ\u65f6\u8fdb\u884c\u5207\u6362\uff0c\u628a\u8be5\u811a\u672c\u6302\u8f7d\u5728\u6444\u50cf\u673a\u4e0a\uff0c\u5e76\u5728Inspector\u4e0a\u914d\u7f6e\u60f3\u8981\u7684\u5929\u7a7a\u76d2\u6750\u8d28\u3002\n  <\/p>\n<pre><code class=\"language-cs\">using System.Collections;\nusing System.Collections.Generic;\nusing UnityEngine;\n\npublic class SkyboxSwitcher : MonoBehaviour\n{\n    public Material[] skyboxMaterials; \/\/ \u5b58\u50a8\u4e0d\u540c\u5929\u7a7a\u76d2\u7684\u6750\u8d28\n \n    private int currentSkyboxIndex = 0; \/\/ \u5f53\u524d\u5929\u7a7a\u76d2\u7684\u7d22\u5f15\n \n \n \n    void Start()\n \n    {\n \n        RenderSettings.skybox = skyboxMaterials[currentSkyboxIndex]; \/\/ \u521d\u59cb\u8bbe\u7f6e\u5929\u7a7a\u76d2\n \n    }\n \n \n \n    void Update()\n \n    {\n \n        \/\/ \u68c0\u6d4b\u6309\u4e0b 'P' \u952e\n \n        if (Input.GetKeyDown(KeyCode.P))\n \n        {\n \n            \/\/ \u5207\u6362\u5230\u4e0b\u4e00\u4e2a\u5929\u7a7a\u76d2\n \n            SwitchSkybox();\n \n        }\n \n    }\n \n \n \n    void SwitchSkybox()\n \n    {\n \n        \/\/ \u589e\u52a0\u7d22\u5f15\uff0c\u786e\u4fdd\u5faa\u73af\u5207\u6362\n \n        currentSkyboxIndex = (currentSkyboxIndex + 1) % skyboxMaterials.Length;\n \n \n \n        \/\/ \u8bbe\u7f6e\u65b0\u7684\u5929\u7a7a\u76d2\u6750\u8d28\n \n        RenderSettings.skybox = skyboxMaterials[currentSkyboxIndex];\n \n    }\n\n}\n<\/code><\/pre>\n<h2>\n  <\/h2>\n<h2>\n   \u4e94\u3001\u5b9e\u73b0\u62c9\u5f13\u4e0e\u5c04\u7badShootController<br \/>\n  <\/h2>\n<p>\n   \u6309\u4e0b\u5de6\u952e\u65f6\u4f1a\u8fdb\u884c\u84c4\u529b\uff0c\u84c4\u529b\u65f6\u4f1a\u7ed9\u4e0b\u4e00\u6b21\u53d1\u5c04\u7684\u7bad\u63d0\u4f9b\u4e00\u4e2a\u529b\uff0c\u6309\u4e0b\u53f3\u952e\u53ef\u4ee5\u628a\u7bad\u53d1\u5c04\u51fa\u53bb\u3002\n  <\/p>\n<pre><code class=\"language-cs\">using System.Collections;\nusing System.Collections.Generic;\nusing UnityEngine;\nusing UnityEngine.UI;\npublic class ShootController : MonoBehaviour\n{\n    float force;\/\/ \u84c4\u529b\u529b\u91cf\n    const float maxForce = 1f;  \/\/ \u6700\u5927\u529b\u91cf\n    const float chargeRate = 0.1f; \/\/ \u6bcf0.3\u79d2\u84c4\u529b\u7684\u91cf\n    Animator animator;\/\/\u5f13\u52a8\u753b\u63a7\u5236\n    float mouseDownTime;\/\/ \u8bb0\u5f55\u9f20\u6807\u84c4\u529b\u65f6\u95f4\n    bool isCharging=false;\/\/\u662f\u5426\u6b63\u5728\u84c4\u529b\n    public AudioSource audio;\n    bool isFired=true; \/\/\u662f\u5426\u5df2\u7ecf\u5c06\u84c4\u529b\u7684\u7bad\u53d1\u5c04\n    public Slider Powerslider;\/\/\u84c4\u529b\u6761\n    public SpotController currentSpotController;\n\n    public bool readyToShoot = false;\/\/\u662f\u5426\u53ef\u4ee5\u5f00\u59cb\u5c04\u51fb\n    public int shootNum;\/\/ \u5269\u4f59\u5c04\u51fb\u6b21\u6570\n    \/\/ Start is called before the first frame update\n    void Start()\n    {\n        shootNum = 0; \n        Singleton&lt;UserGUI&gt;.Instance.SetShootNum(shootNum);\n        animator = GetComponent&lt;Animator&gt;();\n        animator.SetFloat(\"power\", 1f);\n    }\n\n    \/\/ Update is called once per frame\n    void Update()\n    {\n        \/\/ if(shootNum&gt;0){\n        \/\/     readyToShoot = true;\n        \/\/ }\n        if (!readyToShoot)\n        {\n            Powerslider.gameObject.SetActive(false);\n            return;\n        }else{\n            Powerslider.gameObject.SetActive(true);\n        }\n        \/\/\u6309\u7167\u9f20\u6807\u6309\u4e0b\u7684\u65f6\u95f4\u84c4\u529b\uff0c\u6bcf0.3\u79d2\u84c40.1\u7684\u529b\uff08\u6700\u591a0.5)\u52a0\u5230animator\u7684power\u5c5e\u6027\u4e0a\uff0c\u5e76\u7528\u76f8\u5e94\u7684\u529b\u5c04\u7bad\n        if (Input.GetMouseButtonDown(0) &amp;&amp; isFired) \/\/ 0\u8868\u793a\u9f20\u6807\u5de6\u952e\n        {   \n            isFired = false;\n            mouseDownTime = Time.time;  \/\/ \u8bb0\u5f55\u9f20\u6807\u6309\u4e0b\u7684\u65f6\u95f4\n            isCharging = true;  \/\/ \u5f00\u59cb\u84c4\u529b\n            Powerslider.gameObject.SetActive(true);\/\/\u663e\u793a\u84c4\u529b\u6761\n            animator.SetTrigger(\"start\"); \/\/ \u542f\u52a8\u5c04\u7bad\u52a8\u753b\n        }\n\n        \/\/\u6839\u636e\u84c4\u529b\u7a0b\u5ea6\u66f4\u65b0\u5f13\u7684\u52a8\u753b\n        if (isCharging)\n        {\n            float holdTime = Time.time - mouseDownTime; \/\/ \u8ba1\u7b97\u9f20\u6807\u6309\u4e0b\u7684\u65f6\u95f4\n            force = Mathf.Min(holdTime \/ 0.3f * chargeRate, maxForce); \/\/ \u8ba1\u7b97\u84c4\u529b\u7684\u91cf\uff0c\u6700\u5927\u4e3a0.5\n            Powerslider.value = force \/ maxForce; \/\/ \u66f4\u65b0\u529b\u91cf\u6761\u7684\u503c\n            animator.SetFloat(\"power\", force);\n        }\n\n        \/\/\u9f20\u6807\u5de6\u952e\u5f39\u8d77\uff0c\u6b64\u65f6\u8fdb\u5165hold\u52a8\u753b\n        if(Input.GetMouseButtonUp(0))\n        {\n            animator.SetTrigger(\"hold\");\n            isCharging = false;\n        }\n\n        \/\/\u6309\u4e0b\u9f20\u6807\u53f3\u952e\uff0c\u5c06\u5f13\u7bad\u53d1\u5c04\u51fa\u53bb\n        if (Input.GetMouseButtonDown(1) &amp;&amp; readyToShoot)\n        {   \n            audio = GetComponent&lt;AudioSource&gt;();\n            audio.Play();\n            isFired = true;\n            \/\/isCharging = false;  \/\/ \u505c\u6b62\u84c4\u529b\n            animator.SetTrigger(\"shoot\");\n            animator.SetFloat(\"power\", force);  \/\/ \u5c06\u84c4\u529b\u7684\u91cf\u52a0\u5230animator\u7684power\u5c5e\u6027\u4e0a\n            StartCoroutine(DelayedFireCoroutine(force));\/\/\u5ef6\u8fdf0.5s\u540e\u5c04\u51fb\n            Powerslider.value = 0;\/\/\u6e05\u96f6\u84c4\u529b\u6761\n            animator.SetFloat(\"power\", 0f);\n\n            \/\/update shootNum\n            shootNum--;\n            currentSpotController.shootNum--;\n            Singleton&lt;UserGUI&gt;.Instance.SetShootNum(shootNum);\n            if (shootNum == 0)\n            {\n                readyToShoot = false;\n            }\n        }\n    }\n\n    public void AddShootNum(int sn){\n        shootNum += sn;\n        Singleton&lt;UserGUI&gt;.Instance.SetShootNum(shootNum);\n    } \n    \/\/\u534f\u7a0b\uff1a\u5f00\u706b\n    IEnumerator DelayedFireCoroutine(float f)\n    {\n        yield return new WaitForSeconds(0.2f);\/\/\u7b49\u5f850.2s\u540e\n        fire(f);    \n    }\n\n    \/\/\u5c04\u51fb\uff0c\u521b\u5efa\u7bad\u7684\u5bf9\u8c61\u5e76\u4e14\u7ed9\u5176\u8d4b\u4e88\u5c5e\u6027\n    public void fire(float f)\n    {\n        GameObject arrow = Instantiate&lt;GameObject&gt;(Resources.Load&lt;GameObject&gt;(\"Prefabs\/Arrow\"));\n        ArrowFeature arrowFeature = arrow.AddComponent&lt;ArrowFeature&gt;();\n        \/\/ \u4f7f\u7528Find\u65b9\u6cd5\u901a\u8fc7\u5b50\u5bf9\u8c61\u7684\u540d\u5b57\u83b7\u53d6arrow\u5b50\u5bf9\u8c61\n        Transform originArrowTransform = transform.Find(\"\u7bad\");\n        \n        arrow.transform.position = originArrowTransform.position;\n        arrow.transform.rotation = transform.rotation;\n\n        Rigidbody arrow_db = arrow.GetComponent&lt;Rigidbody&gt;();\n\n        arrowFeature.startPos = arrowFeature.transform.position;\n        arrow.tag = \"Arrow\";\n        arrow_db.velocity = transform.forward * 100 * f;\n    }\n\n}\n<\/code><\/pre>\n<p>\n   \u5728\u5c4f\u5e55\u4e0a\u65b9\u653e\u7f6e\u4e86\u4e00\u4e2a\u84c4\u529b\u6761Slider\uff0c\u7528\u4e8e\u663e\u793a\u84c4\u529b\u7a0b\u5ea6\u3002\n  <\/p>\n<\/p>\n<p>\n   \u4e3a\u4e86\u8ba9\u62c9\u5f13\u548c\u5c04\u7bad\u7684\u52a8\u753b\u80fd\u591f\u6b63\u5e38\u914d\u5408\uff0c\u8fd8\u9700\u8981\u7ed9\u5f13\u52a0\u4e0a\u4e00\u4e2aAnimator\u7ec4\u4ef6\u3002\n  <\/p>\n<\/p>\n<h2>\n   \u516d\u3001\u5229\u7528\u53cc\u6444\u50cf\u673a\u5b9e\u73b0\u7784\u51c6<br \/>\n  <\/h2>\n<p>\n   \u5728\u89d2\u8272player\u4e0a\u6dfb\u52a0\u4e00\u4e2a\u6444\u50cf\u673a\uff0c\u653e\u5728\u5f13\u5f29\u7684\u524d\u65b9\uff0c\u901a\u8fc7\u6309\u4e0bQ\u952e\u8fdb\u884c\u6444\u50cf\u673a\u5207\u6362\uff0c\u8fd9\u6837\u5c31\u6709\u4e86\u7784\u51c6\u7684\u6548\u679c\n  <\/p>\n<h3>\n   ChangeCamera<br \/>\n  <\/h3>\n<p>\n   \u8be5\u811a\u672c\u6302\u8f7d\u5728\u4e00\u4e2a\u7a7a\u7269\u4f53\u4e0a\uff0c\u7528\u4e8e\u5b9e\u73b0\u6444\u50cf\u673a\u7684\u5207\u6362\uff0c\u521d\u59cb\u65f6\u7784\u51c6\u6444\u50cf\u673acamera_1\u5904\u4e8e\u4e0d\u6fc0\u6d3b\u72b6\u6001\uff0c\u5f53\u6309\u4e0b\u7784\u51c6\u6309\u94aeQ\u540e\uff0c\u4e24\u4e2a\u6444\u50cf\u673a\u72b6\u6001\u4e92\u6362\u3002\n  <\/p>\n<pre><code class=\"language-cs\">using System.Collections;\nusing System.Collections.Generic;\nusing UnityEngine;\n\npublic class ChangeCamera : MonoBehaviour\n{\n    public GameObject camera_0;\/\/\u8bbe\u7f6e\u6210public\u53ef\u4ee5\u4f7funity\u4e2d\u51fa\u73b0\u5982\u4e0b\u56fe\u6240\u793a\u7684\n    public GameObject camera_1;\n    bool isActive_0;\n    bool isActive_1;\n    \/\/ Start is called before the first frame update\n    void Start()\n    {\n        isActive_0 = true;\n        isActive_1 = false;\n        camera_1.SetActive(isActive_1);\n    }\n\n    \/\/ Update is called once per frame\n    void Update()\n    {\n        if(Input.GetKeyDown(KeyCode.Q)){\n            change();\n        }\n    }\n\n    public void change(){\n        isActive_0 = isActive_0 ? false : true;\n        isActive_1 = isActive_1 ? false : true;\n        camera_0.SetActive(isActive_0);\n        camera_1.SetActive(isActive_1);\n    }\n}\n<\/code><\/pre>\n<h2>\n   \u4e03\u3001\u7bad\u7684\u5c5e\u6027ArrowFeatrue<br \/>\n  <\/h2>\n<p>\n   \u5982\u679c\u4e0e\u9776\u5b50\u53d1\u751f\u4e86\u78b0\u649e\uff0c\u7bad\u4f1a\u505c\u7559\u5728\u9776\u5b50\u4e0a5s\n  <\/p>\n<pre><code class=\"language-cs\">using System.Collections;\nusing System.Collections.Generic;\nusing UnityEngine;\n\npublic class ArrowFeature : MonoBehaviour\n{\n    public Vector3 startPos;\n    public Vector3 startDir;\n    public Transform target;\/\/collider transform\n    public float speed;\n    public float destoryTime;\n\n    Rigidbody rb;\n\n    \/\/ Start is called before the first frame update\n    void Start()\n    {\n        rb = GetComponent&lt;Rigidbody&gt;();\n        destoryTime = 10f;\n    }\n\n    \/\/ Update is called once per frame\n    void Update()\n    {\n        destoryTime -= Time.deltaTime;\n        if (destoryTime &lt; 0)\n        {\n            Destroy(this.transform.gameObject);\n        }\n    }\n    void OnCollisionEnter(Collision collision)\n    {\n        if (collision.gameObject.tag == \"target\")\n        {\n            if (!rb.isKinematic)\n            {\n                rb.isKinematic = true;\n                target = collision.gameObject.transform;\n                transform.SetParent(target);\n            }\n            destoryTime = 5f;\n\n        }\n\n    }\n\n}\n\n<\/code><\/pre>\n<\/p>\n<h2>\n   \u516b\u3001\u9776\u5b50\u63a7\u5236\u5668TargetController<br \/>\n  <\/h2>\n<p>\n   \u6709\u4e00\u4e2abool\u7c7b\u578b\u7684\u53d8\u91cfmove\u6765\u51b3\u5b9a\u8be5\u9776\u5b50\u662f\u5426\u4e3a\u79fb\u52a8\u9776\uff0c\u5982\u679c\u4e3a\u79fb\u52a8\u9776\uff0c\u901a\u8fc7\u8ba1\u7b97\u4e0b\u4e00\u5e27\u7684\u4f4d\u7f6e\u6765\u5b9e\u73b0\u79fb\u52a8\u3002\n  <\/p>\n<p>\n   \u901a\u8fc7\u5224\u65ad\u662f\u5426\u4e0e\u7bad\u5355\u4f4d\u53d1\u751f\u78b0\u649e\uff0c\u6765\u5b9e\u73b0\u52a0\u5206\u3002\n  <\/p>\n<pre><code class=\"language-cs\">using System.Collections;\nusing System.Collections.Generic;\nusing UnityEngine;\n\npublic class TargetController : MonoBehaviour\n{\n    public int basepoint;\/\/\u521d\u59cb\u5206\u6570\n    public bool move; \/\/ \u662f\u5426\u79fb\u52a8\u9776\n    \/\/public float aniSpeed = 1f;\/\/\u52a8\u753b\u6267\u884c\u901f\u5ea6\n    public int scores;\/\/\u5355\u4e2a\u9776\u70b9\u7684\u5206\u6570\n    \/\/\u9776\u5b50\u7684\u79fb\u52a8\u901f\u5ea6\n    public float speed = 5f; \n    \/\/\u9776\u5b50\u7684\u79fb\u52a8\u8ddd\u79bb\n    public float distance = 10f; \n \n    \/\/\u9776\u5b50\u7684\u8d77\u59cb\u4f4d\u7f6e\n    private Vector3 startPosition;\n    \/\/\u9776\u5b50\u7684\u79fb\u52a8\u65b9\u5411\n    private float direction = 1f;\n\n    \/\/ Use this for initialization\n    void Start()\n    {   \n        \/\/\u8bb0\u5f55\u8d77\u59cb\u4f4d\u7f6e\n        startPosition = transform.position;\n        this.tag = \"target\";\n        \/\/move = false;\n        \/\/\u521d\u59cb\u5206\u6570\n        scores= 0;\n    }\n\n    private void move_target(){\n        \/\/\u8ba1\u7b97\u4e0b\u4e00\u5e27\u7684\u4f4d\u7f6e\n        Vector3 nextPosition = transform.position + new Vector3(speed * direction * Time.deltaTime, 0f, 0f);\n \n        \/\/ \u5224\u65ad\u662f\u5426\u8d85\u51fa\u79fb\u52a8\u8303\u56f4\uff0c\u8d85\u51fa\u5219\u6539\u53d8\u79fb\u52a8\u65b9\u5411\n        if (Vector3.Distance(startPosition, nextPosition) &gt; distance)\n        {\n            direction *= -1f;\n        }\n \n        \/\/ \u66f4\u65b0\u4f4d\u7f6e\n        transform.position = nextPosition;\n    }\n    \/\/ Update is called once per frame\n    void Update()\n    {\n        if(move){\n            move_target();\n        }\n    }\n\n    \/\/\u6253\u5230\u9776\u5b50\n    private void OnCollisionEnter(Collision collision)\n    {\n\n        if (collision.gameObject.tag == \"Arrow\")\n        {\n            \n            \/\/scores += 1;\n            \/\/\u589e\u52a0\u6e38\u620f\u603b\u5206\u6570\n            if(move){\n                Singleton&lt;UserGUI&gt;.Instance.AddScore(3);\n            }\n            else{\n                Singleton&lt;UserGUI&gt;.Instance.AddScore(1);\n            }\n            \n            \n        }\n    }\n\n}\n\n<\/code><\/pre>\n<h2>\n   \u4e5d\u3001\u5c04\u51fb\u533a\u5b9e\u73b0<br \/>\n  <\/h2>\n<p>\n   \u9996\u5148\u521b\u5efa\u4e00\u4e2aCylinder\u5bf9\u8c61\uff0c\u8c03\u6574\u9ad8\u5ea6\u4e3a0.05\uff0c\u8fd9\u6837\u770b\u8d77\u6765\u5c31\u5982\u540c\u5e73\u9762\u4e00\u6837\uff0c\u628a\u8fd9\u4e2a\u5bf9\u8c61\u4f5c\u4e3a\u5c04\u51fb\u533a\u57df\uff0c\u6dfb\u52a0Rigidbody\u548cBox Collider\u7ec4\u4ef6\uff0c\u6765\u83b7\u53d6\u4e0e\u89d2\u8272\u7684\u78b0\u649e\u4fe1\u606f\u3002\n  <\/p>\n<\/p>\n<h3>\n   SpotController<br \/>\n  <\/h3>\n<p>\n   \u8fd9\u4e2a\u7c7b\u4e3b\u8981\u7528\u4e8e\u8bb0\u5f55\u5f53\u524d\u5c04\u51fb\u533a\u5185\u8fd8\u6709\u591a\u5c11\u6b21\u5c04\u51fb\u673a\u4f1a\u3002\n  <\/p>\n<pre><code class=\"language-cs\">using System.Collections;\nusing System.Collections.Generic;\nusing UnityEngine;\n\npublic class SpotController : MonoBehaviour\n{\n    public int shootNum;\n    \/\/ Start is called before the first frame update\n    void Start()\n    {\n        \/\/this.tag = \"spot\";\n        shootNum = 5;\n    }\n\n    \/\/ Update is called once per frame\n    void Update()\n    {\n        \n    }\n}\n<\/code><\/pre>\n<h3>\n   PlayerController<br \/>\n  <\/h3>\n<p>\n   \u8fd9\u4e2a\u7c7b\u6302\u8f7d\u5728\u89d2\u8272\u8eab\u4e0a\uff0c\u4e3b\u8981\u7528\u4e8e\u5904\u7406\u78b0\u649e\u4e8b\u4ef6\uff0c\u5982\u679c\u4e0e\u5c04\u51fb\u533a\u53d1\u751f\u4e86\u78b0\u649e\uff0c\u5373\u8fdb\u5165\u4e86\u5c04\u51fb\u533a\uff0c\u4fbf\u4f1a\u8fdb\u5165\u5c04\u51fb\u72b6\u6001\uff0c\u5982\u679c\u79bb\u5f00\u4e86\u5c04\u51fb\u533a\uff0c\u5373\u7ed3\u675f\u4e86\u78b0\u649e\uff0c\u5219\u4f1a\u9000\u51fa\u5c04\u51fb\u72b6\u6001\u3002\n  <\/p>\n<pre><code class=\"language-cs\">using System.Collections;\nusing System.Collections.Generic;\nusing UnityEngine;\n\npublic class PlayerController : MonoBehaviour\n{\n    public ShootController CrossBow;\/\/ \u5f13\u5bf9\u8c61\n    private bool atSpot = false;\/\/ \u662f\u5426\u5230\u8fbe\u5c04\u51fb\u70b9\n    private SpotController spot;\/\/ \u5c04\u51fb\u4f4dcontroller\n    private TargetController[] targetControllers;\/\/target controller\n\n    \/\/ Start is called before the first frame update\n    void Start()\n    {\n        CrossBow = GetComponentInChildren&lt;ShootController&gt;();\n    }\n\n    \/\/ Update is called once per frame\n    void Update()\n    {\n        \/\/\u5982\u679c\u8fdb\u5165\u4e86\u5c04\u51fb\u4f4d\u7f6e\n        if (atSpot)\n        {   \n            \/\/\u5c4f\u5e55\u5de6\u4e0a\u89d2\u51fa\u73b0\u5bf9\u5e94\u63d0\u793a\n            Singleton&lt;UserGUI&gt;.Instance.SetIsAtSpot(true);\n            Singleton&lt;UserGUI&gt;.Instance.SetShootNum(spot.shootNum);\n            \/\/ if (targetControllers != null)\n            \/\/ {\n            \/\/     \/\/\u83b7\u53d6\u8fd9\u4e2a\u5c04\u51fb\u4f4d\u7f6e\u5bf9\u5e94\u9776\u5b50\u7684\u5206\u6570\u4fe1\u606f\n            \/\/     int sumSpotScore = 0;\n            \/\/     foreach (TargetController targetController in targetControllers)\n            \/\/     {\n            \/\/         sumSpotScore += targetController.scores;\n            \/\/     }\n            \/\/     \/\/Singleton&lt;UserGUI&gt;.Instance.SetSpotScore(sumSpotScore);\n            \/\/ }\n        }\n        else\n        {\n            Singleton&lt;UserGUI&gt;.Instance.SetIsAtSpot(false);\n            Singleton&lt;UserGUI&gt;.Instance.SetShootNum(0);\n        }\n    }\n\n    private void OnCollisionEnter(Collision collision){\n       \/\/ Debug.Log(\"1\");\n        if(collision.gameObject.tag == \"spot\"){\n            spot = collision.gameObject.GetComponentInChildren&lt;SpotController&gt;();\n            atSpot = true;\n            \/\/Debug.Log(\"sss\");\n            if (spot.shootNum &gt; 0)\n            {\n                CrossBow.GetComponentInChildren&lt;ShootController&gt;().readyToShoot = true;\n                CrossBow.GetComponentInChildren&lt;ShootController&gt;().shootNum = spot.shootNum;\n                CrossBow.GetComponentInChildren&lt;ShootController&gt;().currentSpotController = spot;\n            }\n\n            \n            \/\/ targetControllers = spot.targetControllers; \n            \/\/ if (targetControllers != null)\n            \/\/ {\n            \/\/     int sumSpotScore = 0;\n            \/\/     foreach (TargetController targetController in targetControllers)\n            \/\/     {\n            \/\/         sumSpotScore += targetController.scores;\n            \/\/     }\n            \/\/     Singleton&lt;UserGUI&gt;.Instance.SetSpotScore(sumSpotScore);\n            \/\/ }\n        }\n    }\n\n        private void OnCollisionExit(Collision collision)\n    {\n        if (collision.gameObject.tag == \"spot\")\n        {\n            Debug.Log(\"collideExit with spot\");\n            CrossBow.GetComponentInChildren&lt;ShootController&gt;().readyToShoot = false;\n            atSpot = false;\n        }\n    }\n\n}\n<\/code><\/pre>\n<h2>\n   \u5341\u3001UserGUI\u7528\u6237\u754c\u9762<br \/>\n  <\/h2>\n<p>\n   \u4e3b\u8981\u5305\u542b\u8fd9\u4e9b\u90e8\u5206\uff1a\u63d0\u793a\u8bcd\u3001\u5012\u8ba1\u65f6\u3001\u8fdb\u5165\u5c04\u51fb\u533a\u65f6\u7684\u63d0\u793a\u4e0e\u5c04\u51fb\u6b21\u6570\u63d0\u793a\uff0c\u6e38\u620f\u7ed3\u675f\u63d0\u793a\u3002\n  <\/p>\n<pre><code class=\"language-cs\">using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing UnityEngine;\nusing static UnityEngine.EventSystems.EventTrigger;\n\npublic enum GameStatus\n{\n    Playing,\n    GameOver,\n}\nstruct Status\n{\n    public int score;\n    public string tip;\n    \/\/public float tipShowTime;\n    public bool atSpot;\n    public GameStatus gameStatus;\n    public int shootNum;\n    public int spotScore;\n}\n\npublic class UserGUI : MonoBehaviour\n{\n    private float timerDuration = 300f; \/\/ 5\u5206\u949f\uff0c\u5355\u4f4d\u4e3a\u79d2\n    private float timer;               \/\/ \u8ba1\u65f6\u5668\n    private GUIStyle playInfoStyle;\n    private Status status; \n    public int crosshairSize = 20;\/\/\u51c6\u661f\u7ebf\u6761\u957f\u5ea6\n    \/\/ Start is called before the first frame update\n    void Start()\n    {\n        \/\/Time.timeScale = 0f;\n        timer = 0f;\n        \/\/ set style\n        playInfoStyle = new GUIStyle();\n        playInfoStyle.normal.textColor = Color.blue;\n        playInfoStyle.fontSize= 25;\n        status.gameStatus = GameStatus.Playing;\n        \/\/ init status\n        \/\/status.shootNum = 5;\n        status.score = 0;\n        status.tip = string.Empty;\n        status.spotScore = 0;\n        status.atSpot = false;\n    }\n\n    \/\/ Update is called once per frame\n    void Update()\n    {\n        \/\/ \u66f4\u65b0\u8ba1\u65f6\u5668\n        timer += Time.deltaTime;\n        \/\/ \u68c0\u67e5\u662f\u5426\u5df2\u7ecf\u5230\u4e86\u8bbe\u5b9a\u7684\u65f6\u95f4\n        if (timer &gt;= timerDuration)\n        {\n            \/\/ \u6267\u884c\u8ba1\u65f6\u7ed3\u675f\u540e\u7684\u903b\u8f91\n            status.gameStatus = GameStatus.GameOver;\n        }\n    }\n\n    public void AddScore(int score){\n        status.score += score;\n    }\n\n    public void SetShootNum(int shootnum){\n        status.shootNum = shootnum;\n    }\n\n    private void showPage(){\n        GUI.Label(new Rect(10, 60, 500, 100), \"P\u2014\u2014\u5207\u6362\u5929\u7a7a\u76d2\" ,playInfoStyle);\n        GUI.Label(new Rect(10, 90, 500, 100), \"Q\u2014\u2014\u8fdb\u5165\u7784\u51c6\u72b6\u6001\", playInfoStyle );\n        GUI.Label(new Rect(10, 180, 500, 100), \"\u5269\u4f59\u65f6\u95f4\" + Mathf.Round(timerDuration-timer).ToString() + \"s\", playInfoStyle);\n        GUI.Label(new Rect(10, 150, 500, 100), \"\u6e38\u620f\u603b\u5206\u6570\uff1a\" + status.score, playInfoStyle);\n        \/\/GUI.Label(new Rect(10, 120, 500, 100), \"\u5269\u4f59\u7bad\u6570\uff1a\" + status.shootNum, playInfoStyle);\n        \/\/ show \u51c6\u661f\n        float screenWidth = Screen.width;\n        float screenHeight = Screen.height;\n        float centerX = screenWidth \/ 2f;\n        float centerY = screenHeight \/ 2f;\n        \/\/ \u8bbe\u7f6e\u51c6\u661f\u989c\u8272\n        GUI.color = Color.red;\n        \/\/ \u7ed8\u5236\u51c6\u661f\n        GUI.DrawTexture(new Rect(centerX - crosshairSize \/ 2f + 15f, centerY + 5f , crosshairSize, 2f), Texture2D.whiteTexture);\n        GUI.DrawTexture(new Rect(centerX - 1f + 15f, centerY - crosshairSize \/ 2f + 5f, 2f, crosshairSize), Texture2D.whiteTexture);\n        \/\/ \u6062\u590dGUI\u989c\u8272\u8bbe\u7f6e\n        GUI.color = Color.white;\n\n        if (status.atSpot)\n        {\n            \/\/ Draw the message with the new GUIStyle\n            GUI.Label(new Rect(10, 120, 500, 100), \"\u60a8\u5df2\u5230\u8fbe\u5c04\u51fb\u4f4d,\u5269\u4f59\u5c04\u51fb\u6b21\u6570\uff1a\" + status.shootNum, playInfoStyle);\n            \/\/GUI.Label(new Rect(10, 90, 500, 100), \"\u60a8\u5728\u8be5\u9776\u70b9\u7684\u5c04\u51fb\u5206\u6570\uff1a\" + status.spotScore, playInfoStyle);\n        }\n\n        \/\/ if (GUI.Button(new Rect(10, 200, 100, 50), \"\u8865\u5145\u5b50\u5f39\"))\n        \/\/ {\n        \/\/     Singleton&lt;ShootController&gt;.Instance.SetShootNum(5);\n        \/\/ }\n    }\n\n    private void showEndPage(){\n        playInfoStyle.fontSize = 65;\n        GUI.Label(new Rect(\n                (Screen.width - 500) \/ 2 - 100,  \/\/ X\u5750\u6807\uff1a\u5c4f\u5e55\u5bbd\u5ea6\u7684\u4e00\u534a\u51cf\u53bb\u6807\u7b7e\u5bbd\u5ea6\u7684\u4e00\u534a\n                (Screen.height - 100) \/ 2  , \/\/ Y\u5750\u6807\uff1a\u5c4f\u5e55\u9ad8\u5ea6\u7684\u4e00\u534a\u51cf\u53bb\u6807\u7b7e\u9ad8\u5ea6\u7684\u4e00\u534a\n                500,                        \/\/ \u5bbd\u5ea6\n                100), \"\u6e38\u620f\u7ed3\u675f\uff0c\u603b\u5f97\u5206\u4e3a:\"+status.score , playInfoStyle);\n    }\n    private void OnGUI(){\n        if(status.gameStatus == GameStatus.Playing){\n            showPage();\n        }\n        else{\n            showEndPage();\n        }\n    }\n    public void SetIsAtSpot(bool isspot){\n        status.atSpot = isspot;\n    }\n}\n<\/code><\/pre>\n<\/p>\n<h2>\n   \u5341\u4e00\u3001\u80cc\u666f\u97f3\u4e50\u4e0e\u5c04\u51fb\u97f3\u6548<br \/>\n  <\/h2>\n<h3>\n   \u80cc\u666f\u97f3\u4e50<br \/>\n  <\/h3>\n<p>\n   \u521b\u5efa\u4e00\u4e2a\u7a7a\u7269\u4f53\uff0c\u6dfb\u52a0Audio Source\u7ec4\u4ef6\uff0c\u5f80\u91cc\u9762\u6dfb\u52a0\u80cc\u666f\u97f3\u4e50\u6587\u4ef6\uff0c\u52fe\u9009play on awake\uff0c\u8fd9\u6837\u5b83\u5c31\u4f1a\u5728\u6e38\u620f\u5f00\u59cb\u540e\u64ad\u653e\n  <\/p>\n<\/p>\n<h3>\n   \u5c04\u51fb\u97f3\u6548<br \/>\n  <\/h3>\n<p>\n   \u5728\u5f13\u7269\u4f53\u4e0a\u6dfb\u52a0Audio Source\u7ec4\u4ef6\uff0c\u6dfb\u52a0\u5c04\u51fb\u97f3\u6548\u6587\u4ef6\uff0c\u7136\u540e\u5728shootController\u91cc\u6dfb\u52a0\u4ee3\u7801\uff0c\u5b9e\u73b0\u6bcf\u6b21\u53d1\u5c04\u5f13\u7bad\u65f6\u64ad\u653e\u5c04\u51fb\u97f3\u6548\u3002\n  <\/p>\n<pre><code class=\"language-cs\">\/\/\u6309\u4e0b\u9f20\u6807\u53f3\u952e\uff0c\u5c06\u5f13\u7bad\u53d1\u5c04\u51fa\u53bb\n        if (Input.GetMouseButtonDown(1) &amp;&amp; readyToShoot)\n        {   \n            audio = GetComponent&lt;AudioSource&gt;();\n            audio.Play();\n            isFired = true;\n            \/\/isCharging = false;  \/\/ \u505c\u6b62\u84c4\u529b\n            animator.SetTrigger(\"shoot\");\n            animator.SetFloat(\"power\", force);  \/\/ \u5c06\u84c4\u529b\u7684\u91cf\u52a0\u5230animator\u7684power\u5c5e\u6027\u4e0a\n            StartCoroutine(DelayedFireCoroutine(force));\/\/\u5ef6\u8fdf0.5s\u540e\u5c04\u51fb\n            Powerslider.value = 0;\/\/\u6e05\u96f6\u84c4\u529b\u6761\n            animator.SetFloat(\"power\", 0f);\n\n            \/\/update shootNum\n            shootNum--;\n            currentSpotController.shootNum--;\n            Singleton&lt;UserGUI&gt;.Instance.SetShootNum(shootNum);\n            if (shootNum == 0)\n            {\n                readyToShoot = false;\n            }\n        }<\/code><\/pre>\n<\/p><\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u524d\u8a00 \u5728\u8be5\u6e38\u620f\u4e2d\uff0c\u73a9\u5bb6\u5c06\u64cd\u63a7\u4e00\u4e2a\u643a\u5e26\u5f13\u5f29\u7684\u89d2\u8272\uff0c\u5728\u6709\u9650\u7684\u65f6\u95f4\u5185\u5c3d\u91cf\u83b7\u5f97\u66f4\u591a\u7684\u79ef\u5206\uff0c\u79ef\u5206\u53ef\u4ee5\u901a\u8fc7\u5c04\u4e2d\u9776\u5b50\u83b7\u5f97\uff0c\u9776 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":215,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[23],"tags":[],"class_list":["post-66","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-23"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.6 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Unity\u2014\u2014\u7b2c\u4e00\u4eba\u79f0\u5c04\u51fb\u6e38\u620f - \u7269\u5ae9\u8f6f\u4ef6\u8d44\u8baf\u7f51<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"http:\/\/www.wunen.com\/index.php\/2025\/03\/27\/unity-\u7b2c\u4e00\u4eba\u79f0\u5c04\u51fb\u6e38\u620f\/\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Unity\u2014\u2014\u7b2c\u4e00\u4eba\u79f0\u5c04\u51fb\u6e38\u620f - \u7269\u5ae9\u8f6f\u4ef6\u8d44\u8baf\u7f51\" \/>\n<meta property=\"og:description\" content=\"\u524d\u8a00 \u5728\u8be5\u6e38\u620f\u4e2d\uff0c\u73a9\u5bb6\u5c06\u64cd\u63a7\u4e00\u4e2a\u643a\u5e26\u5f13\u5f29\u7684\u89d2\u8272\uff0c\u5728\u6709\u9650\u7684\u65f6\u95f4\u5185\u5c3d\u91cf\u83b7\u5f97\u66f4\u591a\u7684\u79ef\u5206\uff0c\u79ef\u5206\u53ef\u4ee5\u901a\u8fc7\u5c04\u4e2d\u9776\u5b50\u83b7\u5f97\uff0c\u9776 [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"http:\/\/www.wunen.com\/index.php\/2025\/03\/27\/unity-\u7b2c\u4e00\u4eba\u79f0\u5c04\u51fb\u6e38\u620f\/\" \/>\n<meta property=\"og:site_name\" content=\"\u7269\u5ae9\u8f6f\u4ef6\u8d44\u8baf\u7f51\" \/>\n<meta property=\"article:published_time\" content=\"2025-03-27T15:57:17+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/www.wunen.com\/wp-content\/uploads\/2025\/03\/\u8d44\u8baf.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"260\" \/>\n\t<meta property=\"og:image:height\" content=\"180\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"admin@wunen\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin@wunen\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"http:\/\/www.wunen.com\/index.php\/2025\/03\/27\/unity-%e7%ac%ac%e4%b8%80%e4%ba%ba%e7%a7%b0%e5%b0%84%e5%87%bb%e6%b8%b8%e6%88%8f\/#article\",\"isPartOf\":{\"@id\":\"http:\/\/www.wunen.com\/index.php\/2025\/03\/27\/unity-%e7%ac%ac%e4%b8%80%e4%ba%ba%e7%a7%b0%e5%b0%84%e5%87%bb%e6%b8%b8%e6%88%8f\/\"},\"author\":{\"name\":\"admin@wunen\",\"@id\":\"https:\/\/www.wunen.com\/#\/schema\/person\/d5f7a6cf545656a9c90d507e64452db8\"},\"headline\":\"Unity\u2014\u2014\u7b2c\u4e00\u4eba\u79f0\u5c04\u51fb\u6e38\u620f\",\"datePublished\":\"2025-03-27T15:57:17+00:00\",\"mainEntityOfPage\":{\"@id\":\"http:\/\/www.wunen.com\/index.php\/2025\/03\/27\/unity-%e7%ac%ac%e4%b8%80%e4%ba%ba%e7%a7%b0%e5%b0%84%e5%87%bb%e6%b8%b8%e6%88%8f\/\"},\"wordCount\":40,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.wunen.com\/#organization\"},\"image\":{\"@id\":\"http:\/\/www.wunen.com\/index.php\/2025\/03\/27\/unity-%e7%ac%ac%e4%b8%80%e4%ba%ba%e7%a7%b0%e5%b0%84%e5%87%bb%e6%b8%b8%e6%88%8f\/#primaryimage\"},\"thumbnailUrl\":\"http:\/\/www.wunen.com\/wp-content\/uploads\/2025\/03\/\u8d44\u8baf.jpg\",\"articleSection\":[\"\u5c04\u51fb\u6e38\u620f\"],\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"http:\/\/www.wunen.com\/index.php\/2025\/03\/27\/unity-%e7%ac%ac%e4%b8%80%e4%ba%ba%e7%a7%b0%e5%b0%84%e5%87%bb%e6%b8%b8%e6%88%8f\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"http:\/\/www.wunen.com\/index.php\/2025\/03\/27\/unity-%e7%ac%ac%e4%b8%80%e4%ba%ba%e7%a7%b0%e5%b0%84%e5%87%bb%e6%b8%b8%e6%88%8f\/\",\"url\":\"http:\/\/www.wunen.com\/index.php\/2025\/03\/27\/unity-%e7%ac%ac%e4%b8%80%e4%ba%ba%e7%a7%b0%e5%b0%84%e5%87%bb%e6%b8%b8%e6%88%8f\/\",\"name\":\"Unity\u2014\u2014\u7b2c\u4e00\u4eba\u79f0\u5c04\u51fb\u6e38\u620f - \u7269\u5ae9\u8f6f\u4ef6\u8d44\u8baf\u7f51\",\"isPartOf\":{\"@id\":\"https:\/\/www.wunen.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"http:\/\/www.wunen.com\/index.php\/2025\/03\/27\/unity-%e7%ac%ac%e4%b8%80%e4%ba%ba%e7%a7%b0%e5%b0%84%e5%87%bb%e6%b8%b8%e6%88%8f\/#primaryimage\"},\"image\":{\"@id\":\"http:\/\/www.wunen.com\/index.php\/2025\/03\/27\/unity-%e7%ac%ac%e4%b8%80%e4%ba%ba%e7%a7%b0%e5%b0%84%e5%87%bb%e6%b8%b8%e6%88%8f\/#primaryimage\"},\"thumbnailUrl\":\"http:\/\/www.wunen.com\/wp-content\/uploads\/2025\/03\/\u8d44\u8baf.jpg\",\"datePublished\":\"2025-03-27T15:57:17+00:00\",\"breadcrumb\":{\"@id\":\"http:\/\/www.wunen.com\/index.php\/2025\/03\/27\/unity-%e7%ac%ac%e4%b8%80%e4%ba%ba%e7%a7%b0%e5%b0%84%e5%87%bb%e6%b8%b8%e6%88%8f\/#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"http:\/\/www.wunen.com\/index.php\/2025\/03\/27\/unity-%e7%ac%ac%e4%b8%80%e4%ba%ba%e7%a7%b0%e5%b0%84%e5%87%bb%e6%b8%b8%e6%88%8f\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"http:\/\/www.wunen.com\/index.php\/2025\/03\/27\/unity-%e7%ac%ac%e4%b8%80%e4%ba%ba%e7%a7%b0%e5%b0%84%e5%87%bb%e6%b8%b8%e6%88%8f\/#primaryimage\",\"url\":\"http:\/\/www.wunen.com\/wp-content\/uploads\/2025\/03\/\u8d44\u8baf.jpg\",\"contentUrl\":\"http:\/\/www.wunen.com\/wp-content\/uploads\/2025\/03\/\u8d44\u8baf.jpg\",\"width\":260,\"height\":180},{\"@type\":\"BreadcrumbList\",\"@id\":\"http:\/\/www.wunen.com\/index.php\/2025\/03\/27\/unity-%e7%ac%ac%e4%b8%80%e4%ba%ba%e7%a7%b0%e5%b0%84%e5%87%bb%e6%b8%b8%e6%88%8f\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wunen.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Unity\u2014\u2014\u7b2c\u4e00\u4eba\u79f0\u5c04\u51fb\u6e38\u620f\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wunen.com\/#website\",\"url\":\"https:\/\/www.wunen.com\/\",\"name\":\"\u7269\u5ae9\u8f6f\u4ef6\u8d44\u8baf\u7f51\",\"description\":\"\u8f6f\u4ef6\u8d44\u8baf\u6765\u7269\u5ae9\",\"publisher\":{\"@id\":\"https:\/\/www.wunen.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wunen.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.wunen.com\/#organization\",\"name\":\"\u7269\u5ae9\u8f6f\u4ef6\u8d44\u8baf\u7f51\",\"url\":\"https:\/\/www.wunen.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wunen.com\/#\/schema\/logo\/image\/\",\"url\":\"http:\/\/www.wunen.com\/wp-content\/uploads\/2025\/03\/cropped-\u7269\u5ae9-1.png\",\"contentUrl\":\"http:\/\/www.wunen.com\/wp-content\/uploads\/2025\/03\/cropped-\u7269\u5ae9-1.png\",\"width\":1024,\"height\":1024,\"caption\":\"\u7269\u5ae9\u8f6f\u4ef6\u8d44\u8baf\u7f51\"},\"image\":{\"@id\":\"https:\/\/www.wunen.com\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wunen.com\/#\/schema\/person\/d5f7a6cf545656a9c90d507e64452db8\",\"name\":\"admin@wunen\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wunen.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/d90ec1e3faf77c4d4e66e40c29b85ff6401161e0502f401dae2f0e25b38ce25e?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/d90ec1e3faf77c4d4e66e40c29b85ff6401161e0502f401dae2f0e25b38ce25e?s=96&d=mm&r=g\",\"caption\":\"admin@wunen\"},\"sameAs\":[\"http:\/\/www.wunen.com\"],\"url\":\"http:\/\/www.wunen.com\/index.php\/author\/adminwunen\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Unity\u2014\u2014\u7b2c\u4e00\u4eba\u79f0\u5c04\u51fb\u6e38\u620f - \u7269\u5ae9\u8f6f\u4ef6\u8d44\u8baf\u7f51","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"http:\/\/www.wunen.com\/index.php\/2025\/03\/27\/unity-\u7b2c\u4e00\u4eba\u79f0\u5c04\u51fb\u6e38\u620f\/","og_locale":"zh_CN","og_type":"article","og_title":"Unity\u2014\u2014\u7b2c\u4e00\u4eba\u79f0\u5c04\u51fb\u6e38\u620f - \u7269\u5ae9\u8f6f\u4ef6\u8d44\u8baf\u7f51","og_description":"\u524d\u8a00 \u5728\u8be5\u6e38\u620f\u4e2d\uff0c\u73a9\u5bb6\u5c06\u64cd\u63a7\u4e00\u4e2a\u643a\u5e26\u5f13\u5f29\u7684\u89d2\u8272\uff0c\u5728\u6709\u9650\u7684\u65f6\u95f4\u5185\u5c3d\u91cf\u83b7\u5f97\u66f4\u591a\u7684\u79ef\u5206\uff0c\u79ef\u5206\u53ef\u4ee5\u901a\u8fc7\u5c04\u4e2d\u9776\u5b50\u83b7\u5f97\uff0c\u9776 [&hellip;]","og_url":"http:\/\/www.wunen.com\/index.php\/2025\/03\/27\/unity-\u7b2c\u4e00\u4eba\u79f0\u5c04\u51fb\u6e38\u620f\/","og_site_name":"\u7269\u5ae9\u8f6f\u4ef6\u8d44\u8baf\u7f51","article_published_time":"2025-03-27T15:57:17+00:00","og_image":[{"width":260,"height":180,"url":"http:\/\/www.wunen.com\/wp-content\/uploads\/2025\/03\/\u8d44\u8baf.jpg","type":"image\/jpeg"}],"author":"admin@wunen","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin@wunen","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"7 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"http:\/\/www.wunen.com\/index.php\/2025\/03\/27\/unity-%e7%ac%ac%e4%b8%80%e4%ba%ba%e7%a7%b0%e5%b0%84%e5%87%bb%e6%b8%b8%e6%88%8f\/#article","isPartOf":{"@id":"http:\/\/www.wunen.com\/index.php\/2025\/03\/27\/unity-%e7%ac%ac%e4%b8%80%e4%ba%ba%e7%a7%b0%e5%b0%84%e5%87%bb%e6%b8%b8%e6%88%8f\/"},"author":{"name":"admin@wunen","@id":"https:\/\/www.wunen.com\/#\/schema\/person\/d5f7a6cf545656a9c90d507e64452db8"},"headline":"Unity\u2014\u2014\u7b2c\u4e00\u4eba\u79f0\u5c04\u51fb\u6e38\u620f","datePublished":"2025-03-27T15:57:17+00:00","mainEntityOfPage":{"@id":"http:\/\/www.wunen.com\/index.php\/2025\/03\/27\/unity-%e7%ac%ac%e4%b8%80%e4%ba%ba%e7%a7%b0%e5%b0%84%e5%87%bb%e6%b8%b8%e6%88%8f\/"},"wordCount":40,"commentCount":0,"publisher":{"@id":"https:\/\/www.wunen.com\/#organization"},"image":{"@id":"http:\/\/www.wunen.com\/index.php\/2025\/03\/27\/unity-%e7%ac%ac%e4%b8%80%e4%ba%ba%e7%a7%b0%e5%b0%84%e5%87%bb%e6%b8%b8%e6%88%8f\/#primaryimage"},"thumbnailUrl":"http:\/\/www.wunen.com\/wp-content\/uploads\/2025\/03\/\u8d44\u8baf.jpg","articleSection":["\u5c04\u51fb\u6e38\u620f"],"inLanguage":"zh-Hans","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["http:\/\/www.wunen.com\/index.php\/2025\/03\/27\/unity-%e7%ac%ac%e4%b8%80%e4%ba%ba%e7%a7%b0%e5%b0%84%e5%87%bb%e6%b8%b8%e6%88%8f\/#respond"]}]},{"@type":"WebPage","@id":"http:\/\/www.wunen.com\/index.php\/2025\/03\/27\/unity-%e7%ac%ac%e4%b8%80%e4%ba%ba%e7%a7%b0%e5%b0%84%e5%87%bb%e6%b8%b8%e6%88%8f\/","url":"http:\/\/www.wunen.com\/index.php\/2025\/03\/27\/unity-%e7%ac%ac%e4%b8%80%e4%ba%ba%e7%a7%b0%e5%b0%84%e5%87%bb%e6%b8%b8%e6%88%8f\/","name":"Unity\u2014\u2014\u7b2c\u4e00\u4eba\u79f0\u5c04\u51fb\u6e38\u620f - \u7269\u5ae9\u8f6f\u4ef6\u8d44\u8baf\u7f51","isPartOf":{"@id":"https:\/\/www.wunen.com\/#website"},"primaryImageOfPage":{"@id":"http:\/\/www.wunen.com\/index.php\/2025\/03\/27\/unity-%e7%ac%ac%e4%b8%80%e4%ba%ba%e7%a7%b0%e5%b0%84%e5%87%bb%e6%b8%b8%e6%88%8f\/#primaryimage"},"image":{"@id":"http:\/\/www.wunen.com\/index.php\/2025\/03\/27\/unity-%e7%ac%ac%e4%b8%80%e4%ba%ba%e7%a7%b0%e5%b0%84%e5%87%bb%e6%b8%b8%e6%88%8f\/#primaryimage"},"thumbnailUrl":"http:\/\/www.wunen.com\/wp-content\/uploads\/2025\/03\/\u8d44\u8baf.jpg","datePublished":"2025-03-27T15:57:17+00:00","breadcrumb":{"@id":"http:\/\/www.wunen.com\/index.php\/2025\/03\/27\/unity-%e7%ac%ac%e4%b8%80%e4%ba%ba%e7%a7%b0%e5%b0%84%e5%87%bb%e6%b8%b8%e6%88%8f\/#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["http:\/\/www.wunen.com\/index.php\/2025\/03\/27\/unity-%e7%ac%ac%e4%b8%80%e4%ba%ba%e7%a7%b0%e5%b0%84%e5%87%bb%e6%b8%b8%e6%88%8f\/"]}]},{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"http:\/\/www.wunen.com\/index.php\/2025\/03\/27\/unity-%e7%ac%ac%e4%b8%80%e4%ba%ba%e7%a7%b0%e5%b0%84%e5%87%bb%e6%b8%b8%e6%88%8f\/#primaryimage","url":"http:\/\/www.wunen.com\/wp-content\/uploads\/2025\/03\/\u8d44\u8baf.jpg","contentUrl":"http:\/\/www.wunen.com\/wp-content\/uploads\/2025\/03\/\u8d44\u8baf.jpg","width":260,"height":180},{"@type":"BreadcrumbList","@id":"http:\/\/www.wunen.com\/index.php\/2025\/03\/27\/unity-%e7%ac%ac%e4%b8%80%e4%ba%ba%e7%a7%b0%e5%b0%84%e5%87%bb%e6%b8%b8%e6%88%8f\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wunen.com\/"},{"@type":"ListItem","position":2,"name":"Unity\u2014\u2014\u7b2c\u4e00\u4eba\u79f0\u5c04\u51fb\u6e38\u620f"}]},{"@type":"WebSite","@id":"https:\/\/www.wunen.com\/#website","url":"https:\/\/www.wunen.com\/","name":"\u7269\u5ae9\u8f6f\u4ef6\u8d44\u8baf\u7f51","description":"\u8f6f\u4ef6\u8d44\u8baf\u6765\u7269\u5ae9","publisher":{"@id":"https:\/\/www.wunen.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wunen.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"zh-Hans"},{"@type":"Organization","@id":"https:\/\/www.wunen.com\/#organization","name":"\u7269\u5ae9\u8f6f\u4ef6\u8d44\u8baf\u7f51","url":"https:\/\/www.wunen.com\/","logo":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wunen.com\/#\/schema\/logo\/image\/","url":"http:\/\/www.wunen.com\/wp-content\/uploads\/2025\/03\/cropped-\u7269\u5ae9-1.png","contentUrl":"http:\/\/www.wunen.com\/wp-content\/uploads\/2025\/03\/cropped-\u7269\u5ae9-1.png","width":1024,"height":1024,"caption":"\u7269\u5ae9\u8f6f\u4ef6\u8d44\u8baf\u7f51"},"image":{"@id":"https:\/\/www.wunen.com\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.wunen.com\/#\/schema\/person\/d5f7a6cf545656a9c90d507e64452db8","name":"admin@wunen","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wunen.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/d90ec1e3faf77c4d4e66e40c29b85ff6401161e0502f401dae2f0e25b38ce25e?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/d90ec1e3faf77c4d4e66e40c29b85ff6401161e0502f401dae2f0e25b38ce25e?s=96&d=mm&r=g","caption":"admin@wunen"},"sameAs":["http:\/\/www.wunen.com"],"url":"http:\/\/www.wunen.com\/index.php\/author\/adminwunen\/"}]}},"_links":{"self":[{"href":"http:\/\/www.wunen.com\/index.php\/wp-json\/wp\/v2\/posts\/66","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.wunen.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.wunen.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.wunen.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.wunen.com\/index.php\/wp-json\/wp\/v2\/comments?post=66"}],"version-history":[{"count":0,"href":"http:\/\/www.wunen.com\/index.php\/wp-json\/wp\/v2\/posts\/66\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/www.wunen.com\/index.php\/wp-json\/wp\/v2\/media\/215"}],"wp:attachment":[{"href":"http:\/\/www.wunen.com\/index.php\/wp-json\/wp\/v2\/media?parent=66"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.wunen.com\/index.php\/wp-json\/wp\/v2\/categories?post=66"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.wunen.com\/index.php\/wp-json\/wp\/v2\/tags?post=66"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}