Esempio n. 1
0
    IEnumerator Start()
    {
        // basescriptコンポーネントを取得
        basescript = GetComponent <Basescript> ();

        while (true)
        {
            /*// 弾をプレイヤーと同じ位置/角度で作成
             * if (way <= 1) {
             *      Instantiate(bullet, origin.position, origin.rotation);
             * }
             * if (way == 2) {
             *      Instantiate(bullet, origin.position, origin.rotation);
             *      Instantiate(bullet, origin.position, origin.rotation);
             *
             * } else {
             *      Instantiate(bullet, origin.position, origin.rotation);
             *      Instantiate(bullet, origin.position, origin.rotation);
             *      Instantiate(bullet, origin.position, origin.rotation);
             *
             * }
             *
             * basescript.Shot (transform);*/

            // shotDelay秒待つ
            yield return(new WaitForSeconds(basescript.shotDelay));
        }
    }
Esempio n. 2
0
    IEnumerator Start()
    {
        // Spaceshipコンポーネントを取得
        basescript = GetComponent <Basescript> ();

        // ローカル座標のY軸のマイナス方向に移動する
        basescript.Move(transform.right * -1);
        //getting item procession (addshot)
        //addshot = GameObject.FindGameObjectWithTag("shot").GetComponent<Itemscript>();
        // canShotがfalseの場合、ここでコルーチンを終了させる
        if (basescript.canShot == false)
        {
            yield break;
        }
        while (true)
        {
            //Debug.Log("thogh");

            // 子要素を全て取得する
            for (int i = 0; i < transform.childCount; i++)
            {
                //Debug.Log("throgh");
                Transform shotPosition = transform.GetChild(i);

                // ShotPositionの位置/角度で弾を撃つ
                basescript.Shot(shotPosition);
            }

            // shotDelay秒待つ
            yield return(new WaitForSeconds(basescript.shotDelay));
        }
    }
Esempio n. 3
0
 void Start()
 {
     basescript = GetComponent <Basescript> ();
     GetComponent <Rigidbody2D> ().velocity = transform.right.normalized * speed;
 }