{"id":1614,"date":"2023-06-12T15:01:12","date_gmt":"2023-06-12T06:01:12","guid":{"rendered":"http:\/\/www.tyosuke20xx.com\/blog\/?p=1614"},"modified":"2023-06-12T15:02:22","modified_gmt":"2023-06-12T06:02:22","slug":"unity%e3%80%80c%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=1614","title":{"rendered":"Unity\u3000C# \u30e1\u30bd\u30c3\u30c9"},"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; int playerHp = 100;<\/p>\n\n\n\n<p>&nbsp; &nbsp; int playerAtk = 50;<\/p>\n\n\n\n<p>&nbsp; &nbsp; int bossHp = 100;<\/p>\n\n\n\n<p>&nbsp; &nbsp; int bossAtk = 20;<\/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; Debug.Log(&#8220;\u9b54\u738b\u304c\u73fe\u308c\u305f\uff01&#8221;);<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; Turn();<\/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; void Turn()<\/p>\n\n\n\n<p>&nbsp; &nbsp; {<\/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; }<\/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; &nbsp; &nbsp; \/\/ \u4f55\u304b\u8ffd\u52a0\u306e\u51e6\u7406\u304c\u3042\u308c\u3070\u3053\u3053\u306b\u8a18\u8ff0\u3059\u308b<\/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=1614\" class=\"more-link\"><span class=\"screen-reader-text\">&#8220;Unity\u3000C# \u30e1\u30bd\u30c3\u30c9&#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-1614","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\/1614","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=1614"}],"version-history":[{"count":2,"href":"http:\/\/www.tyosuke20xx.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1614\/revisions"}],"predecessor-version":[{"id":1616,"href":"http:\/\/www.tyosuke20xx.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1614\/revisions\/1616"}],"wp:attachment":[{"href":"http:\/\/www.tyosuke20xx.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1614"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.tyosuke20xx.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1614"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.tyosuke20xx.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1614"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}