// Update is called once per frame void Update() { // カーソル表示 abc = settingsUI.activeSelf; if (settingsUI.activeSelf) { Cursor.visible = true; Cursor.lockState = CursorLockMode.None; if (Input.GetKeyDown(KeyCode.Return)) { if (GametoTitle.GetAnswer()) // ポーズUIのアクティブ、非アクティブを切り替え { settingsUI.SetActive(!settingsUI.activeSelf); Time.timeScale = 1f; } } } // else{Cursor.visible = false; // Cursor.lockState = CursorLockMode.Locked;} if (Input.GetKeyDown(KeyCode.Return) && PauseScript.pause() && GametoTitle.GetModeSelect() == "Settings") { // ポーズUIのアクティブ、非アクティブを切り替え settingsUI.SetActive(false); this.GetComponent <PauseScript>().OnPause(); // ポーズUIが表示されてる時は停止 if (settingsUI.activeSelf) { Time.timeScale = 0f; // ポーズUIが表示されてなければ通常通り進行 } } }
// Update is called once per frame private void Update() { // if (Input.GetKey(KeyCode.Return)) // { m_MouseLook.Init(transform, m_Camera.transform); // //m_Camera.transform.rotation = Quaternion.identity; // } if (!PauseScript.pause() && !SettingScript.Settingpause()) { if (FPSCon.GetComponent <MyStatus>().GetHp() > 1) { RotateView(); // the jump state needs to read here to make sure it is not missed if (!m_Jump) { m_Jump = CrossPlatformInputManager.GetButtonDown("Jump"); } if (!m_PreviouslyGrounded && m_CharacterController.isGrounded) { StartCoroutine(m_JumpBob.DoBobCycle()); PlayLandingSound(); m_MoveDir.y = 0f; m_Jumping = false; } if (!m_CharacterController.isGrounded && !m_Jumping && m_PreviouslyGrounded) { m_MoveDir.y = 0f; } m_PreviouslyGrounded = m_CharacterController.isGrounded; } } }
void Update() { //ここ追加 if (!PauseScript.pause()) { if (!SkillManagement.GetTimeStop()) { //if(!PauseScript.pause()){ //if(!SkillManagement.GetTimeStop()){ // ======== // アニメーション // ======== //あらかじめ設定していたintパラメーター「trans」の値を取り出す. trans = animator.GetInteger("trans"); // 発見フラグ条件判定 if (foundflg == false) { // 敵が正面を向いていて知覚できる範囲内なら if ((transform.position - player.gameObject.transform.position).magnitude < 15 && trans == 0) { foundflg = true; fireflg = true; trans = 0; //intパラメーターの値を設定する. animator.SetInteger("trans", trans); } // プレイヤーとの距離が範囲内なら if ((transform.position - player.gameObject.transform.position).magnitude < 5) { foundflg = true; fireflg = true; trans = 0; //intパラメーターの値を設定する. animator.SetInteger("trans", trans); } // プレイヤーから攻撃を受けたら } // 発見フラグがONなら if (foundflg == true) { // 正面を向き trans = 0; animator.SetInteger("trans", trans); //targetに向かって進む transform.position += transform.forward * ep.speed * 0.1f; } // 発見フラグがOFFなら else if (foundflg == false) { // 角度計算 rot = GetAim(new Vector2(transform.position.x, transform.position.z), new Vector2(player.gameObject.transform.position.x, player.gameObject.transform.position.z)); rot = rot + ep.startrot; // 角度計算 // 正面 if (rot >= -45.0f && rot <= 45.0f) { trans = 0; } // 右面 else if (rot >= 45.0f && rot <= 135.0f) { trans = 1; } // 左面 else if (rot >= -135 && rot <= -45) { trans = 3; } // 後面 else { trans = 2; } //intパラメーターの値を設定する animator.SetInteger("trans", trans); } } } // デバッグ表示 //Debug.Log("FlyerHP"); //Debug.Log(ep.hp); // 敵の体力が0になったら if (ep.hp == 0) { // 死亡時の爆発エフェクトを再生 GameObject de = Instantiate(deadeffect) as GameObject; de.transform.position = this.gameObject.transform.position; de.transform.position = new Vector3(de.transform.position.x, de.transform.position.y, de.transform.position.z); // 死んだときにアイテムポップ if (PopObject) { GameObject po = Instantiate(PopObject) as GameObject; po.transform.position = this.gameObject.transform.position; } // 解放処理 Destroy(de, 2.0f); Destroy(this.gameObject); } // // 弾発射 // // z キーが押された時 // if (Input.GetKeyDown(KeyCode.Z)) // { // if(fireflg == true) // { // fireflg = false; // } // else // { // fireflg = true; // ftime = 0; // } // } // 発射フラグがONなら if (fireflg == true) { if (ftime == 0) { // 弾丸の複製 GameObject bullets = Instantiate(bullet) as GameObject; // マテリアル Material b_material = bullets.GetComponent <SpriteRenderer>().material; if (AILevel == 1) { b_material.SetFloat(propID_h, 0.0f); b_material.SetFloat(propID_s, 0.5f); b_material.SetFloat(propID_c, 0.5f); } else if (AILevel == 2) { b_material.SetFloat(propID_h, 0.45f); b_material.SetFloat(propID_s, 1.0f); b_material.SetFloat(propID_c, 0.7f); } else if (AILevel == 3) { b_material.SetFloat(propID_h, 0.3f); b_material.SetFloat(propID_s, 0.5f); b_material.SetFloat(propID_c, 1.0f); } // 攻撃力の挿入 eap = bullets.GetComponent <EnemyAttackPower>(); eap.SetAtkPower(ep.atk); // 向き方向の取得 Vector3 aim = player.gameObject.transform.position - this.transform.position; // Rigidbodyに力を加えて発射 bullets.GetComponent <Rigidbody>().AddForce(aim, ForceMode.Impulse); // 弾丸の位置を調整 bullets.transform.position = this.gameObject.transform.position; // 三秒後に削除 Destroy(bullets, 3.0f); } ftime++; if (AILevel == 1) { if (ftime > 60) { ftime = 0; } } else if (AILevel == 2) { if (ftime > 50) { ftime = 0; } } else if (AILevel == 3) { if (ftime > 40) { ftime = 0; } } } if (moveflg == true) { if (mtime == 0) { // 乱数 mvalue = Random.Range(-0.1f, 0.1f); } this.gameObject.transform.position = new Vector3( this.gameObject.transform.position.x + mvalue, this.gameObject.transform.position.y + mvalue, this.gameObject.transform.position.z + mvalue ); mtime++; if (mtime > 15) { mtime = 0; moveflg = false; } } // } //} }
/*public void setPause(bool pause) { * Time.timeScale = System.Convert.ToInt32(!pause); * //paused = pause; * pauseUI.gameObject.SetActive(pause); * if (pause == false) * { * pauseSettingsUI.SetActive(false); * HelpWindow.SetActive(false); * } * Player.playerObj.FPSEnable(!pause); * }*/ ///runs pause function in pause script. public static void Pause() { pauseScript.pause(); }