{"id":2013,"date":"2016-11-09T19:42:22","date_gmt":"2016-11-09T10:42:22","guid":{"rendered":"http:\/\/nantoka.filmm.info\/blog\/?p=2013"},"modified":"2017-11-06T11:04:55","modified_gmt":"2017-11-06T02:04:55","slug":"%e3%82%b9%e3%82%af%e3%83%aa%e3%83%97%e3%83%88myquest%e3%82%92%e3%81%96%e3%81%a3%e3%81%8f%e3%82%8a%e5%af%be%e8%a8%b3%e3%81%97%e3%81%a6%e3%81%bf%e3%82%8b","status":"publish","type":"post","link":"https:\/\/nantoka.filmm.info\/blog\/?p=2013","title":{"rendered":"Unity\u5165\u9580-13\u3000\u30b9\u30af\u30ea\u30d7\u30c8myQuest\u3092\u3056\u3063\u304f\u308a\u5bfe\u8a33\u3057\u3066\u307f\u308b"},"content":{"rendered":"<p>\u5bfe\u8a33\u3057\u3066\u307f\u307e\u3057\u305f\uff0e<\/p>\n<p>\u5143\u306e\u30b9\u30af\u30ea\u30d7\u30c8\u306f<\/p>\n<pre class=\"lang:default decode:true \">using UnityEngine;\r\nusing System.Collections;\r\nusing UnityEngine.UI;\/\/UI\u3092\u4f7f\u7528\u3059\u308b\u306e\u306b\u5fc5\u8981\r\nusing UnityEngine.SceneManagement;\/\/\u30b7\u30fc\u30f3\u9077\u79fb\u3092\u3059\u308b\u306e\u306b\u5fc5\u8981\r\n\r\npublic class myQuest : MonoBehaviour {\r\n\r\n\t[SerializeField, HeaderAttribute (\"\u7d4c\u7531\u5730\u306e\u6570\")]\r\n\tpublic int points;\r\n\r\n\t\/\/sound\r\n\t[SerializeField, HeaderAttribute (\"\u52b9\u679c\u97f3\u3092\u30c9\u30ed\u30c3\u30d7\")]\r\n\tpublic AudioClip getSound;\r\n\tpublic AudioClip tickSE;\r\n\r\n\r\n\t\/\/default time\r\n\t[SerializeField, HeaderAttribute (\"\u30ab\u30a6\u30f3\u30c8\u30c0\u30a6\u30f3\u306e\u521d\u671f\u6642\u9593\")]\r\n\tpublic int gameTime;\r\n\t[SerializeField, HeaderAttribute (\"\u6b8b\u6642\u9593\u306eUItext\u3092\u30c9\u30ed\u30c3\u30d7\")]\r\n\tpublic Text timeText;\r\n\t[SerializeField, HeaderAttribute (\"\u6b8b\u308a\u306e\u7d4c\u7531\u5730\u6570\u8868\u793aUI\u3092\u30c9\u30ed\u30c3\u30d7\")]\r\n\tpublic Text nokoriText;\r\n\r\n\t[SerializeField, HeaderAttribute (\"\u30a8\u30f3\u30c7\u30a3\u30f3\u30b0\u306e\u30b7\u30fc\u30f3\u540d\u3092\u5165\u529b\")]\r\n\tpublic string endSceneName;\r\n\r\n\t\/\/audio source get from this script attached\r\n\tAudioSource myaudio;\r\n\r\n\r\n\t\/\/ Use this for initialization\r\n\tvoid Start () {\r\n\r\n\t\tmyaudio =\tGetComponent&lt;AudioSource&gt;();\r\n\t\ttimeText.text = \"\u6b8b\u308a\u6642\u9593\" + gameTime.ToString () + \"\u79d2\";\r\n\t\tnokoriText.text = \"\u306e\u3053\u308a\" + points.ToString () + \"\u500b\";\r\n\t\t\/\/start after nSec\r\n\t\tInvoke(\"timeCount\", 3.5f);\r\n\t}\r\n\t\t\r\n\tvoid Update () {\r\n\t\r\n\t}\r\n\r\n\r\n\t\/\/if hit destroy obj\r\n\tvoid RedirectedOnTriggerEnter(Collider mycollider) {\r\n\t\t\/\/Debug.Log (mycollider.gameObject.tag);\r\n\t\tif (mycollider.gameObject.tag == \"pointObj\") {\r\n\t\t\tpoints--;\r\n\t\t\tnokoriText.text = \"\u306e\u3053\u308a\" + points.ToString () + \"\u500b\";\r\n\t\t\tmyaudio.PlayOneShot (getSound, 0.7F);\r\n\t\t\tDestroy (mycollider.gameObject);\r\n\r\n\t\t\tif (points &lt; 1) {\r\n\t\t\t\t\/\/go end\r\n\t\t\t\tStopCoroutine(\"loop\");\r\n\t\t\t\tInvoke(\"goEnd\", 2f);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tvoid timeCount(){\r\n\t\tStartCoroutine(\"loop\");\r\n\t}<\/pre>\n<p>&nbsp;<\/p>\n<p>\u5bfe\u8a33\u306f\u3053\u3061\u3089\uff08\u753b\u50cf\uff1a\u30af\u30ea\u30c3\u30af\u3067\u62e1\u5927\uff09<\/p>\n<p><a href=\"http:\/\/nantoka.filmm.info\/blog\/wp-content\/uploads\/2016\/11\/8b8a094f52093cc44c1117b446810ebe.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2014\" src=\"http:\/\/nantoka.filmm.info\/blog\/wp-content\/uploads\/2016\/11\/8b8a094f52093cc44c1117b446810ebe.png\" alt=\"%e5%af%be%e8%a8%b3%e3%81%97%e3%81%a6%e3%81%bf%e3%82%88%e3%81%86\" width=\"1490\" height=\"1090\" srcset=\"https:\/\/nantoka.filmm.info\/blog\/wp-content\/uploads\/2016\/11\/8b8a094f52093cc44c1117b446810ebe.png 1490w, https:\/\/nantoka.filmm.info\/blog\/wp-content\/uploads\/2016\/11\/8b8a094f52093cc44c1117b446810ebe-300x219.png 300w, https:\/\/nantoka.filmm.info\/blog\/wp-content\/uploads\/2016\/11\/8b8a094f52093cc44c1117b446810ebe-768x562.png 768w, https:\/\/nantoka.filmm.info\/blog\/wp-content\/uploads\/2016\/11\/8b8a094f52093cc44c1117b446810ebe-1024x749.png 1024w\" sizes=\"auto, (max-width: 1490px) 100vw, 1490px\" \/><\/a><\/p>\n<p>\uff08<a href=\"http:\/\/nantoka.filmm.info\/blog\/?p=2036\">\u6b21\u3078<\/a>\uff09<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5bfe\u8a33\u3057\u3066\u307f\u307e\u3057\u305f\uff0e \u5143\u306e\u30b9\u30af\u30ea\u30d7\u30c8\u306f using UnityEngine; using System.Collections; using UnityEngine.UI;\/\/UI\u3092\u4f7f\u7528\u3059\u308b\u306e\u306b\u5fc5\u8981 using Unity &hellip; <a href=\"https:\/\/nantoka.filmm.info\/blog\/?p=2013\" class=\"more-link\">\u7d9a\u304d\u3092\u8aad\u3080 <span class=\"screen-reader-text\">Unity\u5165\u9580-13\u3000\u30b9\u30af\u30ea\u30d7\u30c8myQuest\u3092\u3056\u3063\u304f\u308a\u5bfe\u8a33\u3057\u3066\u307f\u308b<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13,2,50],"tags":[],"class_list":["post-2013","post","type-post","status-publish","format-standard","hentry","category-c","category-unity","category-50"],"_links":{"self":[{"href":"https:\/\/nantoka.filmm.info\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2013","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nantoka.filmm.info\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nantoka.filmm.info\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nantoka.filmm.info\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/nantoka.filmm.info\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2013"}],"version-history":[{"count":3,"href":"https:\/\/nantoka.filmm.info\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2013\/revisions"}],"predecessor-version":[{"id":2590,"href":"https:\/\/nantoka.filmm.info\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2013\/revisions\/2590"}],"wp:attachment":[{"href":"https:\/\/nantoka.filmm.info\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2013"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nantoka.filmm.info\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2013"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nantoka.filmm.info\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2013"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}