public void Move() { print(transform.position); //死んでいる場合 if (this.dead) { //0.5秒だけネガ if (cametime < 0.05f) { cametime += Time.deltaTime; } else { Camera.main.GetComponent <PP>().enabled = false; } //フレーム Time.fixedDeltaTime = 0.02f * Time.timeScale; //バイブ //Handheld.Vibrate(); //画面揺れ ComonScript.Shaking(); //時間 this.t += Time.deltaTime * 60; //残り5フレームでスローにする if (t > 95) { ComonScript.shakestop = true; Time.timeScale = 0.07f; //カメラを移動、ズームイン Camera.main.transform.position -= new Vector3((Camera.main.transform.position.x - this.transform.position.x) / 10, (Camera.main.transform.position.y - this.transform.position.y) / 10, 0); Camera.main.orthographicSize -= 0.08f; } else { //スロー中はくそを出さない(出したらもそっと出る) HisanM.GetComponent <ShotManageScript>().Fire(15, -2, transform.position - Vector3.forward * 3, new Vector2(Random.Range(-8f, 8f), Random.Range(4f, 16f))); } //爆散 if (this.t >= 100) { Time.timeScale = 1f; Time.fixedDeltaTime = 0.02f * Time.timeScale; //80個のう〇こ while (this.t < 180) { HisanM.GetComponent <ShotManageScript>().Fire(15, -2, transform.position, new Vector2(Random.Range(-8f, 8f), Random.Range(4f, 16f))); this.t++; } if (this.manager.GetComponent <PvpScript>() != null) { this.manager.GetComponent <PvpScript>().someonesdeath = true; } DestroyImmediate(base.gameObject, true); } return; } //オンラインでは自機のみ操作 if (!TitleScript.minnamode || base.photonView.IsMine) { //傾きでジャンプ方向変化 if (this.mx > 0f) { this.toward = 1; } else if (this.mx < 0f) { this.toward = -1; } //スマホ傾け移動 if ((double)Mathf.Abs((float)System.Math.Round((double)Input.acceleration.x, 3) * ComonScript.kando) <= 0.1) { this.mx = 0f; } else if ((double)Mathf.Abs((float)System.Math.Round((double)Input.acceleration.x, 3) * ComonScript.kando) < 0.5) { this.mx = (float)((int)(System.Math.Round((double)Input.acceleration.x, 3) * (double)ComonScript.kando * 10.0) * 2); } else if (System.Math.Round((double)Input.acceleration.x, 3) * (double)ComonScript.kando <= -0.5) { this.mx = -10f; } else if (System.Math.Round((double)Input.acceleration.x, 3) * (double)ComonScript.kando >= 0.5) { this.mx = 10f; } //デバッグ用キー移動 if (Input.GetKey(KeyCode.RightArrow)) { this.mx = 5f * ComonScript.kando; } if (Input.GetKey(KeyCode.LeftArrow)) { this.mx = -5f * ComonScript.kando; } //ショット if (this.touch.GetComponent <TouchReactScript>().shot || Input.GetButtonUp("Fire")) { //オンラインではRPC if (TitleScript.minnamode) { photonView.RPC(nameof(Shot), RpcTarget.All, ++projectileId, photonView.OwnerActorNr); } else { Shot(projectileId++, 1); } this.touch.GetComponent <TouchReactScript>().shot = false; } //ジャンプ if (this.touch.GetComponent <TouchReactScript>().jump || Input.GetButtonUp("Jump")) { //オンラインではRPC if (TitleScript.minnamode) { photonView.RPC(nameof(Jump), RpcTarget.All); } else { this.Jump(); } this.touch.GetComponent <TouchReactScript>().jump = false; } //移動 sendvelo = mx * speed * 60f; if (jump) { transform.position += Vector3.right * sendvelo * Time.deltaTime; } } else { //線形補間 elapsedTime += Time.deltaTime; if (Mathf.Abs(start - end) > 20f) { transform.position = new Vector3(end, transform.position.y, -1);; } else { transform.position = new Vector3(Mathf.Lerp(start, end, elapsedTime / 0.2f), transform.position.y, -1); } } }
public void Update() { if (dead) { //0.5秒だけネガ if (cametime < 0.05f) { cametime += Time.deltaTime; } else { Camera.main.GetComponent <PP>().enabled = false; } //フレーム Time.fixedDeltaTime = 0.02f * Time.timeScale; //バイブ //Handheld.Vibrate(); //画面揺れ ComonScript.Shaking(); //時間 this.t += Time.deltaTime * 60; //残り5フレームでスローにする if (t > 95) { ComonScript.shakestop = true; Time.timeScale = 0.07f; //カメラを移動、ズームイン Camera.main.transform.position -= new Vector3((Camera.main.transform.position.x - this.transform.position.x) / 10, (Camera.main.transform.position.y - this.transform.position.y) / 10, 0); Camera.main.orthographicSize -= 0.08f; } else { //スロー中はくそを出さない(出したらもそっと出る) HisanM.GetComponent <ShotManageScript>().Fire(15, -2, transform.position - Vector3.forward * 3, new Vector2(Random.Range(-8f, 8f), Random.Range(4f, 16f))); } //爆散 if (this.t >= 100) { Time.timeScale = 1f; Time.fixedDeltaTime = 0.02f * Time.timeScale; //80個のう〇こ while (this.t < 180) { HisanM.GetComponent <ShotManageScript>().Fire(15, -2, transform.position, new Vector2(Random.Range(-8f, 8f), Random.Range(4f, 16f))); this.t++; } if (this.manager.GetComponent <PvpScript>() != null) { this.manager.GetComponent <PvpScript>().someonesdeath = true; } DestroyImmediate(base.gameObject, true); } return; } else { if (ComonScript.nanid == 3) { return; } //m:自機(こいつ)、e:敵機(プレイヤー) mx = transform.position.x; my = transform.position.y; ex = enemy.transform.position.x; ey = enemy.transform.position.y; //向き if (mx < ex) { toward = 1; } else { toward = -1; } //ロジック変更 mtime--; if (mtime <= 0) { mtime = Random.Range(50, 100); maai = Random.Range(2, 10); //間合いの距離 hani = Random.Range(4, 8); //敵察知の距離 if (ComonScript.nanid == 0) { maai = Random.Range(5, 10); hani = Random.Range(10, 15); } } //間合いに合わせた移動 if (jump == true) { //壁をはさまない if (ComonScript.nanid == 0 || Mathf.Abs(mx - ex) < 15) { //間合いより遠い if (Mathf.Abs(mx - ex) > maai + 1) { Move(true, 0.07f); //近づく } else if (Mathf.Abs(mx - ex) < maai - 1) { Move(false, 0.07f); //遠のく } //壁を挟む } else { toward *= -1; if (30 - Mathf.Abs(mx - ex) < maai - 1) { Move(false, 0.07f); //近づく } else if (30 - Mathf.Abs(mx - ex) > maai + 1) { Move(true, 0.07f); //遠のく } } } //敵察知 if ((Mathf.Abs(mx - ex) < hani) || (30 - Mathf.Abs(mx - ex) < hani)) { //ショット機能 if (my > ey + 0.1f) { if (Sroop > 8) { Shot(++projectileId); //難易度分岐 if (ComonScript.nanid == 0) { Sroop -= 15; } if (ComonScript.nanid == 1) { Sroop -= 10; } if (ComonScript.nanid == 2) { Sroop -= 5; } } Sroop++; //ジャンプ } else if ((my <= ey + 2) && (my >= ey - 3) && (jump == true) && (jtime <= 0)) { Jump(); //逃げる } else if (my < ey - 1) //else if ((my < ey - 0.8) && (TitleScript.selectmode == 5)) { //難易度分岐 if (ComonScript.nanid == 1) { Move(false, 0.02f); } if (ComonScript.nanid == 2) { Move(false, 0.05f); } print("特別逃げシステム"); } } } //ジャンプ猶予 if (jtime >= 0) { jtime--; } }