{"id":1609,"date":"2023-06-12T14:12:56","date_gmt":"2023-06-12T05:12:56","guid":{"rendered":"http:\/\/www.tyosuke20xx.com\/blog\/?p=1609"},"modified":"2023-06-12T14:12:58","modified_gmt":"2023-06-12T05:12:58","slug":"unity-c-%e3%82%b2%e3%83%bc%e3%83%a0%e3%83%97%e3%83%ad%e3%82%b0%e3%83%a9%e3%83%9f%e3%83%b3%e3%82%b0","status":"publish","type":"post","link":"http:\/\/www.tyosuke20xx.com\/blog\/?p=1609","title":{"rendered":"Unity C# \u30b2\u30fc\u30e0\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0"},"content":{"rendered":"\n<p>using System.Collections;<\/p>\n\n\n\n<p>using System.Collections.Generic;<\/p>\n\n\n\n<p>using UnityEngine;<\/p>\n\n\n\n<p>public class test : MonoBehaviour<\/p>\n\n\n\n<p>{<\/p>\n\n\n\n<p>&nbsp; &nbsp; \/\/ Start is called before the first frame update<\/p>\n\n\n\n<p>&nbsp; &nbsp; void Start()<\/p>\n\n\n\n<p>&nbsp; &nbsp; {<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp;int playerHp = 100;<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp;int playerAtk = 50;<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp;int bossHp = 100;<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp;int bossAtk = 20;<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp;Debug.Log(&#8220;\u9b54\u738b\u304c\u73fe\u308c\u305f!&#8221;);<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp;Debug.Log(&#8220;\u52c7\u8005HP&#8221; + playerHp);<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp;Debug.Log(&#8220;\u9b54\u738bHP&#8221; + bossHp);<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp;Debug.Log(&#8220;\u52c7\u8005\u306e\u653b\u6483 \u9b54\u738b\u306b&#8221; + playerAtk + &#8220;\u306e\u30c0\u30e1\u30fc\u30b8\u3092\u4e0e\u3048\u305f&#8221;);<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp;Debug.Log(&#8220;\u9b54\u738b\u306e\u653b\u6483 \u52c7\u8005\u306b&#8221; + bossAtk + &#8220;\u306e\u30c0\u30e1\u30fc\u30b8\u3092\u4e0e\u3048\u305f&#8221;);<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; playerHp = bossAtk;<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; bossHp -= playerAtk;<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp;Debug.Log(&#8220;\u52c7\u8005HP&#8221; + playerHp);<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp;Debug.Log(&#8220;\u9b54\u738bHP&#8221; + bossHp);<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp;Debug.Log(&#8220;\u52c7\u8005\u306e\u653b\u6483 \u9b54\u738b\u306b&#8221; + playerAtk + &#8220;\u306e\u30c0\u30e1\u30fc\u30b8\u3092\u4e0e\u3048\u305f&#8221;);<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp;Debug.Log(&#8220;\u9b54\u738b\u306e\u653b\u6483 \u52c7\u8005\u306b&#8221; + bossAtk + &#8220;\u306e\u30c0\u30e1\u30fc\u30b8\u3092\u4e0e\u3048\u305f&#8221;);<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; playerHp -= bossAtk;<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; bossHp -= playerAtk;<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; Debug.Log(&#8220;\u52c7\u8005HP&#8221; + playerHp);<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; Debug.Log(&#8220;\u9b54\u738bHP&#8221; + bossHp);<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; Debug.Log(&#8220;\u52c7\u8005\u306e\u653b\u6483 \u9b54\u738b\u306b&#8221; + playerAtk + &#8220;\u306e\u30c0\u30e1\u30fc\u30b8\u3092\u4e0e\u3048\u305f&#8221;);<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; Debug.Log(&#8220;\u9b54\u738b\u306e\u653b\u6483 \u52c7\u8005\u306b&#8221; + bossAtk + &#8220;\u306e\u30c0\u30e1\u30fc\u30b8\u3092\u4e0e\u3048\u305f&#8221;);<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; playerHp -= bossAtk;<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; bossHp -= playerAtk;<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; Debug.Log(&#8220;\u9b54\u738b\u306eHP\u304c&#8221; + bossHp + &#8220;\u306b\u306a\u3063\u305f\u3002\u9b54\u738b\u3092\u3084\u3063\u3064\u3051\u305f\uff01&#8221;);<\/p>\n\n\n\n<p>&nbsp; &nbsp; }<\/p>\n\n\n\n<p>&nbsp; &nbsp; \/\/ Update is called once per frame<\/p>\n\n\n\n<p>&nbsp; &nbsp; void Update()<\/p>\n\n\n\n<p>&nbsp; &nbsp; {<\/p>\n\n\n\n<p>&nbsp; &nbsp; }<\/p>\n\n\n\n<p>}<\/p>\n","protected":false},"excerpt":{"rendered":"<p>using System.Collections; using System.Collections.Generic; using UnityEngine; public class test : MonoBehavio &hellip; <a href=\"http:\/\/www.tyosuke20xx.com\/blog\/?p=1609\" class=\"more-link\"><span class=\"screen-reader-text\">&#8220;Unity C# \u30b2\u30fc\u30e0\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0&#8221; \u306e<\/span>\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_uf_show_specific_survey":0,"_uf_disable_surveys":false,"footnotes":""},"categories":[1],"tags":[3,14],"class_list":["post-1609","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-programming","tag-unity"],"aioseo_notices":[],"jetpack_featured_media_url":"","_links":{"self":[{"href":"http:\/\/www.tyosuke20xx.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1609","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.tyosuke20xx.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.tyosuke20xx.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.tyosuke20xx.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.tyosuke20xx.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1609"}],"version-history":[{"count":1,"href":"http:\/\/www.tyosuke20xx.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1609\/revisions"}],"predecessor-version":[{"id":1610,"href":"http:\/\/www.tyosuke20xx.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1609\/revisions\/1610"}],"wp:attachment":[{"href":"http:\/\/www.tyosuke20xx.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1609"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.tyosuke20xx.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1609"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.tyosuke20xx.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1609"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}