Esempio n. 1
0
    // Use this for initialization
    //void Start () {
    //}

    IEnumerator Start()
    {
        // Spaceshipコンポーネントを取得
        spaceship = GetComponent <StgSpaceship>();

        while (true)
        {
            // 弾をプレイヤーと同じ位置/角度で作成
            spaceship.Shot(transform);

            // shotDelay秒待つ
            yield return(new WaitForSeconds(spaceship.shot_delay_));
        }

        /*
         * while (true)
         * {
         *  // 弾をプレイヤーと同じ位置/角度で作成
         *  Instantiate(bullet, transform.position, transform.rotation);
         *  // 0.05秒待つ
         *  yield return new WaitForSeconds(0.05f);
         * }
         */
    }
Esempio n. 2
0
    // Use this for initialization

    IEnumerator Start()
    {
        spaceship = GetComponent <StgSpaceship>();
        // 移動
        spaceship.Move(transform.up * -1);

        if (spaceship.can_shot_ == false)
        {
            // 弾を撃たない場合ここで終了
            yield break;
        }
        while (true)
        {
            for (int i = 0; i < transform.childCount; ++i)
            {
                Transform shotPosition = transform.GetChild(i);

                // shotPositionの位置と角度で弾を撃つ
                spaceship.Shot(shotPosition);
            }
            // 少し待つ
            yield return(new WaitForSeconds(spaceship.shot_delay_));
        }
    }