using System.Collections; using System.Collections.Generic; using UnityEngine; public class ArrowGenerator : MonoBehaviour { public GameObject arrowPrefab; [Header("¥¹¥Ô¡¼¥É¥¢¥Ã¥×¥¢¥¤¥Æ¥à¤Î¥×¥ì¥Õ¥¡¥Ö")] // Äɲà public GameObject speedItemPrefab; // Äɲà [Header("Ìð¤Î½Ð¸½Î¨")] // Äɲà public int arrowRate; // Äɲà [Header("¥¹¥Ô¡¼¥É¥¢¥Ã¥×¥¢¥¤¥Æ¥à¤Î½Ð¸½Î¨")] // Äɲà public int speedItemRate; // Äɲà float span = 1.0f; float delta = 0; public float minSpan = 0.5f; public float decSpan; // Start is called before the first frame update void Start() { } // Update is called once per frame void Update() { // this.span -= this.span * Time.deltaTime; // float·¿ this.delta += Time.deltaTime; // Debug.Log(Time.deltaTime); if(this.delta > this.span) { this.delta = 0; /* ¤³¤³¤«¤éÄɲà */ // ¥¤¥ó¥¹¥¿¥ó¥¹¤·¤¿GameObject¤òÂåÆþ¤¹¤ë¤¿¤á¤ÎÊÑ¿ô¤ò¡¢¶õ¤ÇÍÑ°Õ¤¹¤ë GameObject go = null; // Ìð¤ÎÀ¸À®Î¨¤È¥¢¥¤¥Æ¥à¤ÎÀ¸À®Î¨¤ò¹ç·×¤·¡¢¤½¤ÎÈÏ°ÏÆâ¤Ç¥é¥ó¥À¥à¤ÊÃͤò£±¤Ä¼èÆÀ int randomValue = Random.Range(0, (arrowRate + speedItemRate)); // randomValue ¤ÎÃͤ¬ Ìð¤ÎÀ¸À®Î¨ÈÏ°ÏÆâ¤Ê¤é if (randomValue < arrowRate) { // Ìð¤òÀ¸À®¤·¡¢ÊÑ¿ô¤ËÂåÆþ go = Instantiate(arrowPrefab); } // randomValue ¤ÎÃͤ¬Ìð¤ÎÀ¸À®Î¨Èϰϳ°¤Ê¤é else { ¥¢¥¤¥Æ¥à¤òÀ¸À®¤·¡¢ÊÑ¿ô¤ËÂåÆþ go = Instantiate(speedItemPrefab); } /* ¤³¤³¤Þ¤Ç */ int px = Random.Range(-14, 15); go.transform.position = new Vector3(px, 7, 0); if(this.span > this.minSpan) { this.span -= this.decSpan; //Debug.Log(this.span); } } } }