{"id":285,"date":"2025-05-21T21:29:25","date_gmt":"2025-05-21T12:29:25","guid":{"rendered":"https:\/\/infognu.ansan.ac.kr\/PortFolio\/202351028\/?p=285"},"modified":"2025-05-29T10:26:25","modified_gmt":"2025-05-29T01:26:25","slug":"11%ec%a3%bc%ec%b0%a8","status":"publish","type":"post","link":"https:\/\/infognu.ansan.ac.kr\/PortFolio\/202351028\/2025\/05\/21\/11%ec%a3%bc%ec%b0%a8\/","title":{"rendered":"11\uc8fc\ucc28"},"content":{"rendered":"\n<p><strong>\u25a0 \uad6c\ud604 \uae30\ub2a5<\/strong><br>\u00b7 \uac8c\uc784 \uc2dc\uc791 \ud654\uba74 UI ( Game Start, exit )<br>\u00b7 E \ud0a4\ub85c \ubc14\ub2e5\uc758 \uc544\uc774\ud15c\uc744 \uc90d\uace0, I \ud0a4\ub85c \uc778\ubca4\ud1a0\ub9ac \ucc3d\uc744 \uc5f4\uc5b4 \ud655\uc778\ud560 \uc218 \uc788\ub294 \uae30\ub2a5<br>\u00b7 \uc544\uc774\ud15c\uc774 \uc778\ubca4\ud1a0\ub9ac \uc2ac\ub86f\uc5d0 \ud45c\uc2dc\ub418\uace0, \uc6b0\ud074\ub9ad \uc2dc &#8216;USE&#8217; \/ &#8216;THROW&#8217; \uba54\ub274\uac00 \ud45c\uc2dc\ub428<br>\u00b7 &#8216;THROW&#8217; \uc120\ud0dd \uc2dc \uc544\uc774\ud15c\uc774 \ub2e4\uc2dc \ubc14\ub2e5\uc5d0 \ub4dc\ub78d<\/p>\n\n\n\n<p><strong><em>\u25a0 \uac8c\uc784 \uc2dc\uc791 \ud654\uba74 UI ( Game Start, exit )<\/em><\/strong><\/p>\n\n\n\n<figure class=\"wp-block-video\"><video height=\"540\" style=\"aspect-ratio: 888 \/ 540;\" width=\"888\" controls src=\"https:\/\/infognu.ansan.ac.kr\/PortFolio\/202351028\/wp-content\/uploads\/sites\/50\/2025\/05\/KakaoTalk_20250529_040543604.mp4\"><\/video><figcaption class=\"wp-element-caption\">\uc2dc\uc791\ud654\uba74<\/figcaption><\/figure>\n\n\n\n<p>&#8212; \uac8c\uc784 \uc2dc\uc791\ud654\uba74 UI &#8212;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>using UnityEngine;\nusing UnityEngine.SceneManagement;\n\npublic class StartMenu : MonoBehaviour\n{\n    public void StartGame()\n    {\n        SceneManager.LoadScene(\"GameScene\"); \/\/ \uc52c \uc774\ub984 \uc815\ud655\ud788 \ub9de\ucdb0\uc57c \ud568!\n    }\n\n    public void QuitGame()\n    {\n        Application.Quit(); \/\/ \ube4c\ub4dc\ub41c \uac8c\uc784\uc5d0\uc11c\ub9cc \uc791\ub3d9\n        Debug.Log(\"\uac8c\uc784 \uc885\ub8cc\"); \/\/ \uc5d0\ub514\ud130\uc5d0\uc11c\ub294 \uc774 \ub85c\uadf8\ub9cc \ucc0d\ud798\n    }\n}<\/code><\/pre>\n\n\n\n<p> &#8220;Game Start&#8221; \ubc84\ud2bc\uc744 \ub204\ub974\uba74 \ub2e4\uc74c \uc52c\uc73c\ub85c \ub118\uc5b4\uac00\uace0, &#8220;exit&#8221; \ubc84\ud2bc\uc744 \ub204\ub974\uba74 \uc885\ub8cc<br><br><strong><em> \u25a0  E \ud0a4\ub85c \ubc14\ub2e5\uc758 \uc544\uc774\ud15c\uc744 \uc90d\uace0, I \ud0a4\ub85c \uc778\ubca4\ud1a0\ub9ac \ucc3d\uc744 \uc5f4\uc5b4 \ud655\uc778\ud560 \uc218 \uc788\ub294 \uae30\ub2a5<br> <\/em>\u25a0 <em> I\ud0a4 \ub204\ub974\uba74 \uc778\ubca4\ud1a0\ub9ac \ucc3d \uc5f4\ub9ac\uace0 \ub2eb\ud798<\/em><br> \u25a0  \uc2ac\ub86f \uc5ec\ub7ec \uac1c \ubc30\uce58 (Grid\ub85c \uc815\ub82c)<\/strong><\/p>\n\n\n\n<p>1. \uae30\ubcf8 \uad6c\uc870 \ub9cc\ub4e4\uae30<br>1.1. \uc52c\uc5d0 \ub2f9\uadfc \uc2a4\ud504\ub77c\uc774\ud2b8 \ub4dc\ub798\uadf8 \ud574\uc11c \ubc30\uce58 ( \uc624\ube0c\uc81d\ud2b8 \uc774\ub984 : Item_Carrot )<br>1.2. \uc624\ube0c\uc81d\ud2b8\uc5d0 Box Collider 2D \ucef4\ud3ec\ub10c\ud2b8 \ucd94\uac00 ( Is Trigger \uccb4\ud06c )2. PlayerMovement \uc2a4\ud06c\ub9bd\ud2b8 \ub9cc\ub4e4\uae30<br><br>3. InventoryManager \uc2a4\ud06c\ub9bd\ud2b8 \ub9cc\ub4e4\uae30<br><br>4. ItemPickup \uc2a4\ud06c\ub9bd\ud2b8 \ub9cc\ub4e4\uae30<br><br>5. \uc778\ubca4\ud1a0\ub9ac UI \ub9cc\ub4e4\uae30<br>5.1. Canvas\ub97c \uc0dd\uc131 ( \uc774\ub984 : InventoryUI )<br>5.2. Panel\uc744 \ucd94\uac00 ( \uc774\ub984 : InventoryPanel, \ube44\ud65c\uc131\ud654(\ube44\uccb4\ud06c) )<br>5.3 InventoryUI \uc2a4\ud06c\ub9bd\ud2b8 \ub9cc\ub4e4\uae30<\/p>\n\n\n\n<p>6. \uc778\ubca4\ud1a0\ub9ac \uc2ac\ub86f UI \ub9cc\ub4e4\uae30<br>6.1 InventoryUI \uc624\ube0c\uc81d\ud2b8 \uc548\uc5d0 \ud328\ub110 \ucd94\uac00<br>\u00b7 InventoryUI -&gt; \uc6b0\ud074\ub9ad -&gt; UI &gt; Panel<br>6.2 SlotGrid\uc5d0 GirdLayoutGroup \ucef4\ud3ec\ub10c\ud2b8 \ucd94\uac00<br>6.3 TitleText \ucd94\uac00<br>\u00b7 InventoryPanel \uc548\uc5d0 UI &gt; Text &#8211; TextMeshPro ( \uc774\ub984 : TitleText, \ud14d\uc2a4\ud2b8 : Inventory )<br>(Canvas &gt; InventoryUI &gt; InventoryPanel &gt; SlotGrid &gt; Slot &gt; ItemImage \ud615\ud0dc\ub85c \uacc4\uce35 \uad6c\uc131)<\/p>\n\n\n\n<p>7. \uc2ac\ub86f \ud504\ub9ac\ud339 \ub9cc\ub4e4\uae30<br>7.1. UI &gt; Image ( \uc774\ub984 : Slot )<br>7.2. \uc2ac\ub86f \uc548\uc5d0 \uc544\uc774\ud15c \uc774\ubbf8\uc9c0\uc6a9 Image \ucd94\uac00<br>7.3. \uc2ac\ub86f\uc744 \ud504\ub9ac\ud339\uc73c\ub85c \uc800\uc7a5<br>\u00b7 Slot \uc624\ube0c\uc81d\ud2b8\ub97c Project \ucc3d\uc73c\ub85c \ub4dc\ub798\uadf8\ud558\uc5ec \ud504\ub9ac\ud339\uc73c\ub85c \uc800\uc7a5<\/p>\n\n\n\n<p>8. SlotGrid \ub9cc\ub4e4\uae30<br>\u00b7 InventoryPanel \uc548\uc5d0 UI &gt; Empty \ub9cc\ub4e4\uae30 ( \uc774\ub984 : SlotGrid )<br>\u00b7 \ucef4\ud3ec\ub10c\ud2b8 \ucd94\uac00 : Grid Layout Group<\/p>\n\n\n\n<p>9. InventoryUI \uc2a4\ud06c\ub9bd\ud2b8 \uc218\uc815<\/p>\n\n\n\n<p>10. InventoryManager\uc5d0\uc11c \uc544\uc774\ud15c \ucd94\uac00 \ud638\ucd9c<br>\/\/ \uc778\ubca4\ud1a0\ub9ac\uc5d0 \uc544\uc774\ud15c \ucd94\uac00 (carrotSprite\ub294 \uc544\uc774\ud15c \uc2a4\ud504\ub77c\uc774\ud2b8)<br>InventoryUI inventoryUI = GameObject.Find(&#8220;InventoryUI&#8221;).GetComponent();<br>inventoryUI.AddItem(carrotSprite);<\/p>\n\n\n\n<p>11. Inspector \uc5f0\uacb0<br>11.1 InventoryUI \uc624\ube0c\uc81d\ud2b8 \uc120\ud0dd<br>11.2 InventoryUI \uc2a4\ud06c\ub9bd\ud2b8\uc5d0:<br>\u00b7 Slot Prefab: \uc544\uae4c \ub9cc\ub4e0 \ud504\ub9ac\ud339<br>\u00b7 Slot Grid: SlotGrid \uc624\ube0c\uc81d\ud2b8 \ub4dc\ub798\uadf8<\/p>\n\n\n\n<p><em><strong>\u25a0  \uc6b0\ud074\ub9ad: \uc2ac\ub86f \uc704\uc5d0\uc11c \uba54\ub274 \ud31d\uc5c5 (\ubc84\ub9ac\uae30, \uc0ac\uc6a9\ud558\uae30)<br>\u25a0  \ubc84\ub9ac\uae30 \uc120\ud0dd: \uc544\uc774\ud15c\uc774 \ud50c\ub808\uc774\uc5b4 \uc704\uce58\uc5d0 \ub2e4\uc2dc \uc0dd\uc131<\/strong><\/em><\/p>\n\n\n\n<p>1. \uae30\uc874 \uc544\uc774\ud15c \uc624\ube0c\uc81d\ud2b8\ub97c \ud504\ub9ac\ud339\uc73c\ub85c \uc800\uc7a5<br>1.1. Hierarchy\uc5d0 \uc788\ub294 Item_Carrot\ub098 Item_Ball \ub4f1\uc744 Project \ucc3d\uc73c\ub85c \ub4dc\ub798\uadf8<br>1.2. Resources\/Items \ud3f4\ub354\uc5d0 \ub123\uae30<\/p>\n\n\n\n<p>2. \uc6b0\ud074\ub9ad \uba54\ub274 UI \ub9cc\ub4e4\uae30<br>2.1. Canvas \uc548\uc5d0 Panel \uc0dd\uc131 ( \uc774\ub984 : ItemContextMenu )<br>2.2. \uc548\uc5d0 Button 2\uac1c \ucd94\uac00 ( \uc774\ub984 : UseButton, DropButton )<br>2.3. InventorySlot \uc2a4\ud06c\ub9bd\ud2b8 \ub9cc\ub4e4\uae30<br>2.4. ItemContextMenu \uc2a4\ud06c\ub9bd\ud2b8 \ub9cc\ub4e4\uae30<br>2.5 InventoryUI \uc2a4\ud06c\ub9bd\ud2b8\uc5d0 \uc5f0\uacb0<br>\u00b7 Hierarchy\uc5d0\uc11c InventoryUI \uc624\ube0c\uc81d\ud2b8 \uc120\ud0dd -&gt; Inspector\uc5d0\uc11c \ub2e4\uc74c \ud56d\ubaa9\uc744 \uc5f0\uacb0<br>\ud544\ub4dc \uc774\ub984 (Inspector)           \uc5f0\uacb0\ud560 \uc624\ube0c\uc81d\ud2b8<br>Slot Prefab                            Slot \ud504\ub9ac\ud339<br>Slot Grid                                SlotGrid \uc624\ube0c\uc81d\ud2b8 (\uc2ac\ub86f \ubd80\ubaa8)<br>Inventory Panel                     InventoryPanel \uc624\ube0c\uc81d\ud2b8<br>Context Menu                       ItemContextMenu \uc624\ube0c\uc81d\ud2b8<br>Use Button                            ItemContextMenu \ud558\uc704\uc758 UseButton<br>Drop Button                          ItemContextMenu \ud558\uc704\uc758 DropButton<br>Item Prefab                           \uc704\uc5d0\uc11c \ub9cc\ub4e0 Item_Carrot_Prefab \ud504\ub9ac\ud339<\/p>\n\n\n\n<figure class=\"wp-block-video\"><video height=\"1288\" style=\"aspect-ratio: 1216 \/ 1288;\" width=\"1216\" controls src=\"https:\/\/infognu.ansan.ac.kr\/PortFolio\/202351028\/wp-content\/uploads\/sites\/50\/2025\/05\/downtown-inventory-Windows-Mac-Linux-Unity-6-6000.0.42f1_-_DX11_-2025-05-29-04-13-36.mp4\"><\/video><figcaption class=\"wp-element-caption\">\uc544\uc774\ud15c \uc90d\uae30\/\ubc84\ub9ac\uae30\/\ud655\uc778<\/figcaption><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<figure class=\"wp-block-video\"><video height=\"1000\" style=\"aspect-ratio: 1920 \/ 1000;\" width=\"1920\" controls src=\"https:\/\/infognu.ansan.ac.kr\/PortFolio\/202351028\/wp-content\/uploads\/sites\/50\/2025\/05\/\u315e\u314a.mp4\"><\/video><figcaption class=\"wp-element-caption\">npc \uc9c0\uc815 \uacbd\ub85c \uc774\ub3d9<\/figcaption><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\uc0ac\uc6a9 \ucf54\ub4dc<\/li>\n<\/ul>\n\n\n\n<p>using UnityEngine;<\/p>\n\n\n\n<p>public class AlexNPCMovement : MonoBehaviour<br>{<br>public Transform[] waypoints;<br>public float moveSpeed = 2f;<br>private int currentIndex = 0;<br>private Animator animator;<br>private bool isFinished = false;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>void Start()\n{\n    animator = GetComponent&lt;Animator&gt;();\n}\n\nvoid Update()\n{\n    if (waypoints.Length == 0 || isFinished) return;\n\n    Vector3 targetPos = waypoints&#091;currentIndex].position;\n    Vector3 direction = targetPos - transform.position;\n\n    if (direction.magnitude &lt; 0.1f)\n    {\n        animator.SetBool(\"IsMoving\", false);\n        currentIndex++;\n\n\n        if (currentIndex &gt;= waypoints.Length)\n        {\n            isFinished = true;\n        }\n\n        return;\n    }\n\n    Vector3 moveDir = direction.normalized;\n    transform.position += moveDir * moveSpeed * Time.deltaTime;\n\n    animator.SetFloat(\"MoveX\", moveDir.x);\n    animator.SetFloat(\"MoveY\", moveDir.y);\n    animator.SetBool(\"IsMoving\", true);\n}<\/code><\/pre>\n\n\n\n<p>}<\/p>\n\n\n\n<p>\uc9c0\uc815\ub41c \uacbd\ub85c\ub85c \uc798 \uc774\ub3d9\ud558\ub098 \uc18d\ub3c4 + \ub354 \ucd18\ucd18\ud558\uac8c \ud574\uc57c\ud568<\/p>\n\n\n\n<p>\uc774\ub3d9 \uc911 \ud50c\ub808\uc774\uc5b4\uc5d0\uac8c \ub9c9\ud788\uac70\ub098 \ubc00\ub9b4 \uc2dc \uc624\ub958 \ubc1c\uc0dd<\/p>\n\n\n\n<p>\uc560\ub2c8\uba54\uc774\uc158 \uc624\ub958<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u25a0 \uad6c\ud604 \uae30\ub2a5\u00b7 \uac8c\uc784 \uc2dc\uc791 \ud654\uba74 UI ( Game Start, exit )\u00b7 E \ud0a4\ub85c \ubc14\ub2e5\uc758 \uc544\uc774\ud15c\uc744 \uc90d\uace0, I \ud0a4\ub85c \uc778\ubca4\ud1a0\ub9ac \ucc3d\uc744 \uc5f4\uc5b4 \ud655\uc778\ud560 \uc218 \uc788\ub294 \uae30\ub2a5\u00b7 \uc544\uc774\ud15c\uc774 \uc778\ubca4\ud1a0\ub9ac \uc2ac\ub86f\uc5d0 \ud45c\uc2dc\ub418\uace0, \uc6b0\ud074\ub9ad \uc2dc &#8216;USE&#8217; \/ &#8216;THROW&#8217; \uba54\ub274\uac00 \ud45c\uc2dc\ub428\u00b7 &#8216;THROW&#8217; \uc120\ud0dd \uc2dc \uc544\uc774\ud15c\uc774 \ub2e4\uc2dc \ubc14\ub2e5\uc5d0 \ub4dc\ub78d \u25a0 \uac8c\uc784 \uc2dc\uc791 \ud654\uba74 UI ( Game Start, exit ) &#8212;\u2026 <span class=\"read-more\"><a href=\"https:\/\/infognu.ansan.ac.kr\/PortFolio\/202351028\/2025\/05\/21\/11%ec%a3%bc%ec%b0%a8\/\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":50,"featured_media":298,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ngg_post_thumbnail":0,"footnotes":""},"categories":[3],"tags":[],"class_list":["post-285","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-3"],"jetpack_featured_media_url":"https:\/\/infognu.ansan.ac.kr\/PortFolio\/202351028\/wp-content\/uploads\/sites\/50\/2025\/05\/\uc2dc\uc791\ud654\uba741-1.png","_links":{"self":[{"href":"https:\/\/infognu.ansan.ac.kr\/PortFolio\/202351028\/wp-json\/wp\/v2\/posts\/285","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/infognu.ansan.ac.kr\/PortFolio\/202351028\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/infognu.ansan.ac.kr\/PortFolio\/202351028\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/infognu.ansan.ac.kr\/PortFolio\/202351028\/wp-json\/wp\/v2\/users\/50"}],"replies":[{"embeddable":true,"href":"https:\/\/infognu.ansan.ac.kr\/PortFolio\/202351028\/wp-json\/wp\/v2\/comments?post=285"}],"version-history":[{"count":0,"href":"https:\/\/infognu.ansan.ac.kr\/PortFolio\/202351028\/wp-json\/wp\/v2\/posts\/285\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/infognu.ansan.ac.kr\/PortFolio\/202351028\/wp-json\/wp\/v2\/media\/298"}],"wp:attachment":[{"href":"https:\/\/infognu.ansan.ac.kr\/PortFolio\/202351028\/wp-json\/wp\/v2\/media?parent=285"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/infognu.ansan.ac.kr\/PortFolio\/202351028\/wp-json\/wp\/v2\/categories?post=285"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/infognu.ansan.ac.kr\/PortFolio\/202351028\/wp-json\/wp\/v2\/tags?post=285"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}