IEnumerator Enemymove3() { if (posflg == false) { //※必須 mother = obj.GetComponent <oBase>(); direction = mother.Playerposition(transform.position); //※必須 posflg = true; } for (int i = 0; i <= 10; i++) { transform.Translate(movement * direction * mother.enemySpeed, 0, 0); if (i == 10) { bulletInstance = Instantiate(bullet) as GameObject; bulletInstance.transform.position = new Vector3(transform.position.x + direction, transform.position.y, 0); //弾を配置 posflg = false; time = 0; StopCoroutine("Enemymove3"); yield break; } yield return(new WaitForSeconds(0.2f)); //yield return null; } }
oEnemyMove10 parent; //※必須 // Use this for initialization void Start() { obj = GameObject.Find("Reference"); mother = obj.GetComponent <oBase>(); boss2 = GameObject.Find("boss2"); parent = boss2.GetComponent <oEnemyMove10>(); }
float angle;//角度 // Use this for initialization void Start() { enemy9 = GameObject.Find("Enemy9Child"); enemy9Move = enemy9.GetComponent <oEnemyMove9>(); obj = GameObject.Find("Reference"); mother = obj.GetComponent <oBase>(); }
// Use this for initialization void Start() { //パーティクル hitParticle = Resources.Load("yResources/HitParticle") as GameObject; blowParticle2 = Resources.Load("yResources/BlowParticle") as GameObject; //親オブジェクト parent = transform.root.gameObject; //子オブジェクト hpGage = parent.transform.Find("EnemyHPgage/HPbar").GetComponent <yHpgage>(); //オブジェクトの参照 combo = GameObject.Find("Combo").GetComponent <yCombo>(); _oBase = GameObject.Find("Reference").GetComponent <oBase>(); _tWeakPointParent = GetComponent <tWeakPointParent>(); //親オブジェクトのあたり判定 box2D = parent.GetComponent <BoxCollider2D>(); //親オブジェクトの頭文字4文字(Enemyかbossか) enemyName = parent.name.Substring(0, 4); print(enemyName); pos = parent.transform.position; }
// Update is called once per frame void Update()//コサインの値を変更させて移動 { if (transform.tag == "enemy") { time += Time.deltaTime; if (time >= 2.0f)//2秒間隔 { if (posflg == false) { //※必須 mother = obj.GetComponent <oBase>(); direction = mother.Playerposition(transform.position); //※必須 posflg = true; } cos += 0.1f; //コサインの値を増やす transform.Translate(movement * direction, Mathf.Cos(cos) * 0.5f, 0); //山なりに移動 if (transform.position.y <= 0) //自身のY座標が0未満になったとき { posflg = false; cos = 0;//コサインの値を0にする time = 0; } } } }
// Update is called once per frame void Update()//コサインの値を変更させて移動 { pos = transform.position; if (transform.tag == "enemy") { time += Time.deltaTime * mother.enemySpeed; if (time >= 2.0f)//2秒間隔 { if (posflg == false) { //※必須 mother = obj.GetComponent <oBase>(); direction = mother.Playerposition(transform.position); //※必須 posflg = true; } if (cosFlg == true) { transform.Translate(0.13f * direction * mother.enemySpeed, -0.33f * mother.enemySpeed, 0); } else { cos += 0.1f * mother.enemySpeed; //コサインの値を増やす transform.Translate(movement * direction * mother.enemySpeed, Mathf.Cos(cos) * 0.5f * mother.enemySpeed, 0); //山なりに移動 } if (pos.y > transform.position.y) { cosFlg = true; } } } }
// Use this for initialization void Start() { obj = GameObject.Find("Reference"); //oBaseの入っているオブジェクトを探す mother = obj.GetComponent <oBase>(); bulletAngre = transform.localEulerAngles.z; //今の角度を取得 i = mother.firstangle(bulletAngre); //transform.rotation = Quaternion.Euler(0, 0, bulletAngre); }
// Use this for initialization void Start() { player = GameObject.Find("Player"); size = transform.localScale; boss4 = GameObject.Find("boss4"); obj = GameObject.Find("Reference");//oBaseの入っているオブジェクトを探す mother = obj.GetComponent <oBase>(); }
oBase mother; //※必須 // Use this for initialization void Start() { obj = GameObject.Find("Reference"); mother = obj.GetComponent <oBase>(); color.r = 1.0f; color.g = 1.0f; color.b = 1.0f; //Destroy(gameObject,1); }
// Use this for initialization void Start() { pos = transform.position; Destroy(gameObject, f);//f秒後に消す reference = GameObject.Find("Reference"); mother = reference.GetComponent <oBase>(); boss = GameObject.Find("boss2"); boss2 = boss.GetComponent <oEnemyMove10>(); }
// Use this for initialization void Start() { obj = GameObject.Find("Reference"); //oBaseの入っているオブジェクトを探す mother = obj.GetComponent <oBase>(); enemy9 = GameObject.Find("Enemy9"); //oBossBaseの入っているオブジェクトを探す enemy9Move = enemy9.GetComponent <oEnemyMove92>(); boss = obj.GetComponent <oBossBase>(); hpgage = enemy9.transform.Find("EnemyHPgage/HPbar").GetComponent <yHpgage>(); }
// Use this for initialization void Start() { player = GameObject.Find("Player"); color.r = 1.0f; color.g = 1.0f; color.b = 1.0f; color.a = 1.0f; obj = GameObject.Find("Reference");//ベースの入っているオブジェクトを取得、名前を変えて mother = obj.GetComponent <oBase>(); }
// Use this for initialization void Start() { player = GameObject.Find("Player"); //使うときはPlayerに変える BulletAngle(transform.position, player.transform.position); //角度を計算するメソッドに値を入れる transform.rotation = Quaternion.Euler(0, 0, angle); //角度を変える parabola(transform.position, player.transform.position); // obj = GameObject.Find("Reference"); mother = obj.GetComponent <oBase>(); direction = mother.Playerposition(transform.position); }
// Update is called once per frame void Update() { if (transform.tag == "enemy") { time2 += Time.deltaTime; time += Time.deltaTime; if (time2 > 0.3f) { Enemymove8(); } if (posflg == false) { //※必須 mother = obj.GetComponent <oBase>(); direction = mother.Playerposition(transform.position); //※必須 posflg = true; posflg = false;//※必須 } if (time >= 0.1f) { Renderer rend = GetComponent <SpriteRenderer>(); rend.material.color = color; if (alpha >= 0.05f) { alpha -= 0.06f; color.a = alpha; } else { if (direction == 1) { transform.position = new Vector3(player.transform.position.x + 5, player.transform.position.y, player.transform.position.z); } else { transform.position = new Vector3(player.transform.position.x - 5, player.transform.position.y, player.transform.position.z); } time2 = 0.0f; alpha = 1.0f; } time = 0; } } }
// Update is called once per frame void Update() { if (transform.tag == "enemy") { time += Time.deltaTime; if (time > 2)//2秒後 { if (posflg == false) { //※必須 mother = obj.GetComponent <oBase>(); direction = mother.Playerposition(transform.position); posflg = true; //※必須 } if (f <= 40 && flg == false) //回転の大きさが40以下かつ、フラグがfalseなら { f += 0.1f; //回転の大きさを増やす } else//回転の大きさが40を超えたら { flg = true; //減らすためにフラグをtrueにする } if (flg == true) //フラグがtrueなら { if (f >= 0) //回転の大きさが0以上なら { f -= 0.1f; //減らしていく enemyMoveDistance += x; //移動する値を増やしていく transform.position = new Vector3(transform.position.x + enemyMoveDistance * direction, transform.position.y, transform.position.z); //移動 } else { enemyMoveDistance -= x; //移動する値を減らしていく if (enemyMoveDistance <= 1) //移動距離が0以下になったら { time = 0; //時間のカウントを0にする flg = false; //フラグをfalseにする posflg = false; //※必須 } } } } } }
// Use this for initialization void Start() { if (hund == 0) { i = 1; } else { i = -1; } player = GameObject.Find("Player"); playerPos = player.transform.position; boss = GameObject.Find("boss4body"); boss4 = boss.GetComponent <oEnemyMove12>(); obj = GameObject.Find("Reference");//oBaseの入っているオブジェクトを探す mother = obj.GetComponent <oBase>(); pos = transform.position; }
oBase mother; //※必須 // Use this for initialization void Start() { obj = GameObject.Find("Reference"); mother = obj.GetComponent <oBase>(); ii[0] = min; //0番に最小値を記憶 if (max + Mathf.Abs(min) > 180) //角度が180度で収まらない場合 { for (int i = 1; i < way; i++) { ii[i] = ii[i - 1] + (max + Mathf.Abs(min)) / way;//間隔を求めている } } else { for (int i = 1; i < way; i++) { ii[i] = ii[i - 1] + (max + Mathf.Abs(min)) / (way - 1); } } }
// Use this for initialization void Start() { parent = GameObject.Find("Boss3child"); obj = GameObject.Find("Reference"); mother = obj.GetComponent <oBase>(); }
int direction; //向き※必須 // Use this for initialization void Start() { enemyPotision = transform.position; //enemyの座標を取得(必要かどうかは知らないです) obj = GameObject.Find("GameObject"); //名前を変えて oBase tester = obj.GetComponent <oBase>(); }
oBase mother; //※必須 // Use this for initialization void Start() { obj = GameObject.Find("Reference"); mother = obj.GetComponent <oBase>(); Destroy(gameObject, 1.5f); }
oBase mother; //※必須 // Use this for initialization void Start() { obj = GameObject.Find("Reference"); mother = obj.GetComponent <oBase>(); pos = transform.position; }
// Use this for initialization void Start() { obj = GameObject.Find("Reference");//ベースの入っているオブジェクトを取得、名前を変えて mother = obj.GetComponent <oBase>(); }