|
@@ -9,6 +9,9 @@ public class ArmBow : MonoBehaviour
|
|
|
[SerializeField] GameObject arrow;
|
|
[SerializeField] GameObject arrow;
|
|
|
[SerializeField] BowCamera bowCamera;
|
|
[SerializeField] BowCamera bowCamera;
|
|
|
public HashSet<TargetBody> validTargets = new HashSet<TargetBody>();
|
|
public HashSet<TargetBody> validTargets = new HashSet<TargetBody>();
|
|
|
|
|
+
|
|
|
|
|
+ public int shootBackTime = 0;
|
|
|
|
|
+
|
|
|
private bool canShoot = false;
|
|
private bool canShoot = false;
|
|
|
private bool pulling = false;
|
|
private bool pulling = false;
|
|
|
private bool readying = false;
|
|
private bool readying = false;
|
|
@@ -120,6 +123,27 @@ public class ArmBow : MonoBehaviour
|
|
|
|
|
|
|
|
// 筛选出一个稳定的发射角度---start
|
|
// 筛选出一个稳定的发射角度---start
|
|
|
Quaternion best_rotation = this.bowCamera.transform.rotation;
|
|
Quaternion best_rotation = this.bowCamera.transform.rotation;
|
|
|
|
|
+ if (recordCount >= recordRotations.Length) {
|
|
|
|
|
+ int single_check_count = 6;
|
|
|
|
|
+ float min_wave = float.MaxValue;
|
|
|
|
|
+ for (int i = 0; i < recordRotationVars.Length; i++)
|
|
|
|
|
+ {
|
|
|
|
|
+ recordRotationVars[i] = Quaternion.Angle(recordRotations[i], recordRotations[i + 1]);
|
|
|
|
|
+ if (i >= single_check_count - 1)
|
|
|
|
|
+ {
|
|
|
|
|
+ float wave = 0;
|
|
|
|
|
+ for (int j = i; j > i - single_check_count; j--)
|
|
|
|
|
+ {
|
|
|
|
|
+ wave += recordRotationVars[j];
|
|
|
|
|
+ }
|
|
|
|
|
+ if (wave < min_wave)
|
|
|
|
|
+ {
|
|
|
|
|
+ min_wave = wave;
|
|
|
|
|
+ best_rotation = recordRotations[i - single_check_count + 1-this.shootBackTime];
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
// if (recordCount >= recordRotations.Length) {
|
|
// if (recordCount >= recordRotations.Length) {
|
|
|
// int single_check_count = 6;
|
|
// int single_check_count = 6;
|
|
|
// float min_wave = float.MaxValue;
|
|
// float min_wave = float.MaxValue;
|