// Update is called once per frame void Update() { HANDLE_INPUT.UpdateJoyPad(); //Xキーで発射 if (Input.GetKey(KeyCode.X) || HANDLE_INPUT.Button(handleclass.Buttons.ShiftDown) || HANDLE_INPUT.Button(handleclass.Buttons.ShiftUp)) { if (shot_late % late == 0) { //弾の呼び出し GameObject bullet = GameObject.Find("BulletGenerator"); bullet.GetComponent <BulletController>().Shoot( this.transform.position, this.transform.rotation.eulerAngles, this.gameObject, 10000, damage); } shot_late++; } else { shot_late = 0; } }
// Update is called once per frame void Update() { HANDLE_INPUT.UpdateJoyPad(); if (this.GetComponent <PhotonView>().IsMine) { } // 前に移動 if (Input.GetKey(KeyCode.UpArrow) || HANDLE_INPUT.Pedal(handleclass.Pedals.accelerator) > 0.1f) { if (speed >= max_speed * HANDLE_INPUT.Pedal(handleclass.Pedals.accelerator)) { speed -= 0.5f; if (speed <= max_speed * HANDLE_INPUT.Pedal(handleclass.Pedals.accelerator) + 0.5f) { speed = max_speed * HANDLE_INPUT.Pedal(handleclass.Pedals.accelerator); } } else { speed += 0.5f; } if (HANDLE_INPUT.Button(handleclass.Buttons.A) || Input.GetKey(KeyCode.W)) { speed = max_speed * 2; } } else if (Input.GetKey(KeyCode.DownArrow) || HANDLE_INPUT.Pedal(handleclass.Pedals.brake) > 0.1f) { speed -= 2.0f; if (speed <= -25.0f) { speed = -25.0f; } } else { if (speed > 0.0f) { speed -= 1.0f; } else if (speed < 0.0f) { speed += 1.0f; } if (speed <= 0.5f && speed >= -0.5f) { speed = 0.0f; } } if (speed >= 0.0f) { handle = HANDLE_INPUT.LimitHandle(); if (Input.GetKey(KeyCode.LeftArrow)) { handle = -0.5f; } else if (Input.GetKey(KeyCode.RightArrow)) { handle = 0.5f; } direction = 1.0f; } else if (speed < -0.1f) { handle = -HANDLE_INPUT.LimitHandle(); if (Input.GetKey(KeyCode.LeftArrow)) { handle = 0.5f; } else if (Input.GetKey(KeyCode.RightArrow)) { handle = -0.5f; } direction = -1.0f; } transform.Rotate(new Vector3(0.0f, handle * max_rotate, 0.0f)); car_model.transform.localRotation = Quaternion.Euler(0, 0, handle * (-30.0f * direction)); if (handle != 0.0f) { float handle_N; if (handle < 0.0f) { handle_N = -handle; } else { handle_N = handle; } car_model.transform.localPosition = new Vector3(0.0f, handle_N * 0.3f, 0.0f); } rb.velocity = new Vector3(transform.forward.x * speed, rb.velocity.y, transform.forward.z * speed); animator.SetFloat("turn", handle * 10); //Debug.Log(car_model.transform.localPosition.y); //rb.velocity = transform.forward * speed; //Debug.Log(input.Rz); //Debug.Log(Mathf.Sin(transform.rotation.y)); //Debug.Log(handle); //仮設置移行予定 //hpが0になったらポイント半減(変える部分) if (player_hp <= 0) { this.GetComponent <PointController>().DeathPoint(); player_hp = max_hp; } rb.AddForce(Gravity, ForceMode.Acceleration); }