Unity¤Ë´ØÏ¢¤¹¤ëµ­»ö¤Ç¤¹

¡¡¥¹¥Ô¡¼¥É¥¢¥Ã¥×¥¢¥¤¥Æ¥à¤ÈÌð¤ò°ìÄꤴ¤È¤Î³ÎΨ¤Ç£±¤Ä¤º¤Ä¡¢¥é¥ó¥À¥à¤ËÃê½Ð¤·¤ÆÀ¸À®¤¹¤ë¤è¤¦¤ËÊѹ¹¤·¤Þ¤¹¡£

¡¡­¡ArrowGenerator¤Î½¤Àµ
¡¡­¢ArrowGenerator¤ËÀ¸À®¤¹¤ë¥¢¥¤¥Æ¥à¥×¥ì¥Õ¥¡¥Ö¤ò¥¢¥µ¥¤¥ó¤·¡¢À¸À®Î¨¤òÆþÎÏ


­¡ArrowGenerator¤Î½¤Àµ


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);

            }
        }
    }
}

­¢ArrowGenerator¤ËÀ¸À®¤¹¤ë¥¢¥¤¥Æ¥à¥×¥ì¥Õ¥¡¥Ö¤ò¥¢¥µ¥¤¥ó¤·¡¢³ÆÀ¸À®Î¨¤òÆþÎÏ

¡¡
¡¡public ÊÑ¿ô¤¬¥¤¥ó¥¹¥Ú¥¯¥¿¡¼¤Ëɽ¼¨¤µ¤ì¤Þ¤¹¤Î¤Ç¡¢Àè¤Û¤ÉºîÀ®¤·¤¿SpeedUpItem¥×¥ì¥Õ¥¡¥Ö¤ò
ProjectÆâ¤ÎPrefab¥Õ¥©¥ë¥À¤«¤é¥É¥é¥Ã¥°¥¢¥ó¥É¥É¥í¥Ã¥×¤Ç¥¢¥µ¥¤¥ó¤·¤Þ¤¹¡£

¡¡Â³¤¤¤Æ¡¢Ìð¤ÎÀ¸À®Î¨¤È¥¢¥¤¥Æ¥à¤ÎÀ¸À®Î¨¤òÀßÄꤷ¤Þ¤¹¡£
¹ç·×¤¬100¤Ë¤Ê¤ë¤è¤¦¤Ë¤·¤Æ¤ª¤±¤Ð¡Ö100%¤Î¤¦¤Á¡¢Ì𤬲¿%¡¢¥¢¥¤¥Æ¥à¤¬²¿%¡×¤È¤¤¤¦¸«Êý¤¬½ÐÍè¤Þ¤¹¡£

¡¡¥Ç¥Ð¥Ã¥°¤ò·ó¤Í¤Æ¥²¡¼¥à¤ò¼Â¹Ô¤·¤Æ¤ß¤Þ¤·¤ç¤¦¡£
¤³¤³¤Ç¤Ï¿ôÃͤÎÊѲ½¤Ë¤è¤ë¥Ç¥Ð¥Ã¥°¤ÎÊýË¡¤â³Ð¤¨¤Æ¤¤¤­¤Þ¤·¤ç¤¦¡£

¤Þ¤º¤ÏÌð100¡¢¥¢¥¤¥Æ¥à0¤ÇÆþÎϤ·¤Æ¤¢¤ë¾ì¹ç¡¢Ìð¤Î¤ßÀ¸À®¤µ¤ì¤ë¤«³Îǧ¤·¤Þ¤¹¡£
¼¡¤ÏÌð0¡¢¥¢¥¤¥Æ¥à100¤ÇÆþÎϤ·¤Æ¤¢¤ë¾ì¹ç¡¢¥¢¥¤¥Æ¥à¤Î¤ßÀ¸À®¤µ¤ì¤ë¤«³Îǧ¤·¤Þ¤¹¡£

Ìð50¡¢¥¢¥¤¥Æ¥à50¤ÇÆþÎϤ·¤Æ¤¢¤ë¾ì¹ç¡¢ÂçÂΡ¢¸ò¸ß°Ì¤Î³ÎΨ¤ÇÀ¸À®¤Ç¤­¤ì¤ÐÀ®¸ù¤È¸À¤¨¤ë¤Ç¤·¤ç¤¦¡£

¥³¥á¥ó¥È¤ò¤«¤¯


¡Öhttp://¡×¤ò´Þ¤àÅê¹Æ¤Ï¶Ø»ß¤µ¤ì¤Æ¤¤¤Þ¤¹¡£

ÍøÍѵ¬Ìó¤ò¤´³Îǧ¤Î¤¦¤¨¤´µ­Æþ²¼¤µ¤¤

Menu



´ðÁÃ

µ»½Ñ/Ãμ±(¼ÂÁõÎã)

3D¥¢¥¯¥·¥ç¥ó¥²¡¼¥à

2D¤ª¤Ï¤¸¤­¥²¡¼¥à(ȯŸÊÔ)

2D¶¯À©²£¥¹¥¯¥í¡¼¥ë¥¢¥¯¥·¥ç¥ó(ȯŸÊÔ)

2D¥¿¥Ã¥×¥·¥å¡¼¥Æ¥£¥ó¥°(³ÈÄ¥ÊÔ)

¥ì¡¼¥¹¥²¡¼¥à(È´¿è)

2DÊüÃÖ¥²¡¼¥à(ȯŸÊÔ)

3D¥ì¡¼¥ë¥¬¥ó¥·¥å¡¼¥Æ¥£¥ó¥°(±þÍÑÊÔ)

3Dæ½Ð¥²¡¼¥à(È´¿è)

2D¥ê¥¢¥ë¥¿¥¤¥à¥¹¥È¥é¥Æ¥¸¡¼

3D¥¿¥Ã¥×¥¢¥¯¥·¥ç¥ó(NavMeshAgent »ÈÍÑ)

2D¥È¥Ã¥×¥Ó¥å¡¼¥¢¥¯¥·¥ç¥ó(¥«¥¨¥ë¤Î°Ù¤Ë¡Á¡¢¥Ü¥³¥¹¥«¥¦¥©¡¼¥ºÉ÷)

VideoPlayer ¥¤¥Ù¥ó¥ÈϢư¤Î¼ÂÁõÎã

VideoPlayer ¥ê¥¹¥ÈÆ⤫¤é¥à¡¼¥Ó¡¼ºÆÀ¸¤Î¼ÂÁõÎã(ȯŸ)

AR ²èÁüÉÕ¤­¥ª¥Ö¥¸¥§¥¯¥ÈÀ¸À®¤Î¼ÂÁõÎã

AR ¥ê¥¹¥ÈÆ⤫¤éÀ¸À®¤Î¼ÂÁõÎã(ȯŸ)

2D¥È¥Ã¥×¥Ó¥å¡¼¥¢¥¯¥·¥ç¥ó(¥µ¥Ð¥¤¥Ð¡¼É÷)

private



¤³¤Î¥µ¥¤¥ÈÆâ¤ÎºîÉʤϥæ¥Ë¥Æ¥£¤Á¤ã¤ó¥é¥¤¥»¥ó¥¹¾ò¹à¤Î¸µ¤ËÄ󶡤µ¤ì¤Æ¤¤¤Þ¤¹¡£

´ÉÍý¿Í/Éû´ÉÍý¿Í¤Î¤ßÊÔ½¸¤Ç¤­¤Þ¤¹