void Start() { AudioSource[] audioSources = GetComponents <AudioSource>(); sound01 = audioSources[2]; player = GameObject.Find("PlayerMove"); boss = GetComponent <boss1_new>(); }
void dropwepon() { wgato.SetActive(false); Instantiate(Gato, transform.position, transform.rotation); boss = GetComponent <boss1_new>(); boss.a = 40; // 行動パターン武器ドロップ時の隙を呼び出す(現在不安定) dropCount = 1; StartCoroutine("stop"); }
// Use this for initialization void Start() { GameObject enemy = transform.root.gameObject; enemyMove = enemy.GetComponent <EnemyMove>(); GameObject boss = transform.root.gameObject; bossMove = boss.GetComponent <boss1_new>(); }
// Update is called once per frame void Update() { enemyMove = GetComponent <EnemyMove>(); bossMove = GetComponent <boss1_new>(); if (bossMove.find != 1) { this.transform.position += transform.forward * (enemyspeed * Time.deltaTime); if (pattern == 0) { pattern = 1; StartCoroutine("sosaku"); } } }
//GameObject TragetObject = GameObject.FindGameObjectWithTag ("Player"); void OnTriggerEnter(Collider col) { if (col.gameObject.tag == "Player") { GameObject player = GameObject.Find("Player"); GameObject enemy = gameObject.transform.parent.gameObject; GameObject boss = gameObject.transform.parent.gameObject; RaycastHit hit; // ターゲットオブジェクトとの差分を求め Vector3 temp = player.transform.position - enemy.transform.position; // 正規化して方向ベクトルを求める Vector3 normal = temp.normalized; if (Physics.Raycast(enemy.transform.position, normal, out hit)) { if (hit.collider.tag == "Player") { bossMove.find = 1; } if (hit.collider.tag == "Playersub") { bossMove.find = 1; } } if (Physics.Raycast(boss.transform.position, normal, out hit)) { if (hit.collider.tag == "Player") { bossMove = boss.GetComponent <boss1_new>(); bossMove.find = 1; } if (hit.collider.tag == "Playersub") { bossMove = boss.GetComponent <boss1_new>(); bossMove.find = 1; } } } }
IEnumerator syutugen() { yield return(new WaitForSeconds(1.5f)); camera.SetActive(false); //カメラをムービー用に切り替える while (b <= 1) { //フェードインを行いつつ主人公を移動 b += 0.01f; GetComponent <Rigidbody>().AddForce(gameObject.transform.forward * 1.5f, ForceMode.VelocityChange); moviecamera = GameObject.Find("MoivieCamera"); moviecamera.transform.LookAt(gameObject.transform.position); fedeobj = GameObject.Find("fede"); fede = fedeobj.GetComponent <Image>(); fede.color = new Color(0, 0, 0, 1 - b); yield return(null); } for (int i = 0; i < 60; i++) { //主人公を指定地点に移動 GetComponent <Rigidbody>().AddForce(gameObject.transform.forward * 1.5f, ForceMode.VelocityChange); moviecamera.transform.LookAt(gameObject.transform.position); yield return(null); } //ムービーカメラを主人公の目の前に移動する iTween.MoveTo(moviecamera, cameraposi1, 3f); zako = GameObject.Find("zako"); for (int i = 0; i < 270; i++) { //ムービーカメラにザコ敵の場所を向かせる moviecamera.transform.LookAt(zako.transform.position); yield return(null); } boss = GameObject.Find("boss"); //ボスをザコ敵の少し後ろである指定地点に移動 Vector3 pos = boss.transform.position; pos.x -= 13; agent = boss.GetComponent <NavMeshAgent>(); bossposi1 = GameObject.Find("bossposi1"); agent.SetDestination(bossposi1.transform.position); Camera camerrua = moviecamera.GetComponent <Camera>(); yield return(new WaitForSeconds(2.8f)); agent.SetDestination(boss.transform.position); for (int i = 0; i < 10; i++) //ボス見つつズームイン { moviecamera.transform.LookAt(boss.transform.position); camerrua.fieldOfView -= 2.5f; yield return(null); } for (int i = 0; i < 90; i++) { moviecamera.transform.LookAt(boss.transform.position); Vector3 relativePos = gameObject.transform.position - boss.transform.position; Quaternion rotation = Quaternion.LookRotation(relativePos); boss.transform.rotation = Quaternion.Slerp(boss.transform.rotation, rotation, Time.deltaTime * 15f); yield return(null); } bosscon = boss.GetComponent <boss1_new>(); //ガトリングチャージ音再生 bosscon.sound02.PlayOneShot(bosscon.sound02.clip); yield return(new WaitForSeconds(1.5f)); for (int i = 0; i < 2; i++) { camerrua.fieldOfView += 12.5f;//カメラがズームアウトする(早) yield return(null); } yield return(new WaitForSeconds(0.5f)); //主人公に横に移動(回避)させる GetComponent <Rigidbody>().AddForce(gameObject.transform.right * 400, ForceMode.VelocityChange); gatomode = true;//Updateにあるガトリング掃射を許可する yield return(new WaitForSeconds(4f)); iTween.MoveTo(moviecamera, cameraposi1, 3f); moviecamera.SetActive(false); camera.SetActive(true); //BGMをボス用のものに切り替える BGM[0].Stop(); BGM[1].Play(); StartCoroutine("start"); }