lvjincheng 4 years ago
parent
commit
499fc82464

+ 71 - 40
Assets/BowArrow/Scenes/Game.unity

@@ -312,7 +312,7 @@ GameObject:
   serializedVersion: 6
   m_Component:
   - component: {fileID: 39334923}
-  m_Layer: 0
+  m_Layer: 10
   m_Name: Bone016
   m_TagString: Untagged
   m_Icon: {fileID: 0}
@@ -649,7 +649,7 @@ GameObject:
   serializedVersion: 6
   m_Component:
   - component: {fileID: 66110751}
-  m_Layer: 0
+  m_Layer: 10
   m_Name: Bone006
   m_TagString: Untagged
   m_Icon: {fileID: 0}
@@ -727,7 +727,7 @@ Transform:
   m_PrefabAsset: {fileID: 0}
   m_GameObject: {fileID: 105398402}
   m_LocalRotation: {x: 0, y: 0.7071068, z: 0, w: 0.7071068}
-  m_LocalPosition: {x: 0, y: 0, z: 14.58}
+  m_LocalPosition: {x: 0, y: 0, z: 13.5}
   m_LocalScale: {x: 1, y: 1, z: 1}
   m_Children:
   - {fileID: 1522256495}
@@ -1597,7 +1597,7 @@ GameObject:
   m_Component:
   - component: {fileID: 207359068}
   - component: {fileID: 207359069}
-  m_Layer: 0
+  m_Layer: 10
   m_Name: Bow Middle Frame
   m_TagString: Untagged
   m_Icon: {fileID: 0}
@@ -2338,7 +2338,7 @@ GameObject:
   serializedVersion: 6
   m_Component:
   - component: {fileID: 279265280}
-  m_Layer: 0
+  m_Layer: 10
   m_Name: Bone010
   m_TagString: Untagged
   m_Icon: {fileID: 0}
@@ -2552,7 +2552,7 @@ MonoBehaviour:
   m_EditorClassIdentifier: 
   canvasRTF: {fileID: 2027373061}
   mainCamera: {fileID: 394830266}
-  followTarget: {fileID: 3697436075425137358}
+  followTarget: {fileID: 2113407309}
 --- !u!114 &306828145
 MonoBehaviour:
   m_ObjectHideFlags: 0
@@ -3867,7 +3867,7 @@ GameObject:
   - component: {fileID: 506792922}
   - component: {fileID: 506792924}
   - component: {fileID: 506792923}
-  m_Layer: 0
+  m_Layer: 10
   m_Name: Cylinder004
   m_TagString: Untagged
   m_Icon: {fileID: 0}
@@ -3949,7 +3949,7 @@ GameObject:
   - component: {fileID: 511199554}
   - component: {fileID: 511199556}
   - component: {fileID: 511199555}
-  m_Layer: 0
+  m_Layer: 10
   m_Name: Cylinder003
   m_TagString: Untagged
   m_Icon: {fileID: 0}
@@ -4029,7 +4029,7 @@ GameObject:
   serializedVersion: 6
   m_Component:
   - component: {fileID: 518282679}
-  m_Layer: 0
+  m_Layer: 10
   m_Name: Bone019
   m_TagString: Untagged
   m_Icon: {fileID: 0}
@@ -4157,7 +4157,7 @@ GameObject:
   serializedVersion: 6
   m_Component:
   - component: {fileID: 545568208}
-  m_Layer: 0
+  m_Layer: 10
   m_Name: Bone020
   m_TagString: Untagged
   m_Icon: {fileID: 0}
@@ -4220,7 +4220,7 @@ GameObject:
   - component: {fileID: 572916056}
   - component: {fileID: 572916058}
   - component: {fileID: 572916057}
-  m_Layer: 0
+  m_Layer: 10
   m_Name: Cylinder001
   m_TagString: Untagged
   m_Icon: {fileID: 0}
@@ -4470,7 +4470,7 @@ GameObject:
   serializedVersion: 6
   m_Component:
   - component: {fileID: 686102409}
-  m_Layer: 0
+  m_Layer: 10
   m_Name: Bone012
   m_TagString: Untagged
   m_Icon: {fileID: 0}
@@ -4789,7 +4789,7 @@ GameObject:
   serializedVersion: 6
   m_Component:
   - component: {fileID: 727696758}
-  m_Layer: 0
+  m_Layer: 10
   m_Name: Bone003
   m_TagString: Untagged
   m_Icon: {fileID: 0}
@@ -4821,7 +4821,7 @@ GameObject:
   m_Component:
   - component: {fileID: 729695044}
   - component: {fileID: 729695045}
-  m_Layer: 0
+  m_Layer: 10
   m_Name: String TOP
   m_TagString: Untagged
   m_Icon: {fileID: 0}
@@ -5138,7 +5138,7 @@ GameObject:
   serializedVersion: 6
   m_Component:
   - component: {fileID: 777395618}
-  m_Layer: 0
+  m_Layer: 10
   m_Name: Bone001
   m_TagString: Untagged
   m_Icon: {fileID: 0}
@@ -5440,7 +5440,7 @@ GameObject:
   serializedVersion: 6
   m_Component:
   - component: {fileID: 862507083}
-  m_Layer: 0
+  m_Layer: 10
   m_Name: Bone005
   m_TagString: Untagged
   m_Icon: {fileID: 0}
@@ -5471,7 +5471,7 @@ GameObject:
   serializedVersion: 6
   m_Component:
   - component: {fileID: 888099585}
-  m_Layer: 0
+  m_Layer: 10
   m_Name: Bone004
   m_TagString: Untagged
   m_Icon: {fileID: 0}
@@ -6146,7 +6146,7 @@ GameObject:
   m_Component:
   - component: {fileID: 1025376195}
   - component: {fileID: 1025376196}
-  m_Layer: 0
+  m_Layer: 10
   m_Name: String BOTTOM
   m_TagString: Untagged
   m_Icon: {fileID: 0}
@@ -6486,7 +6486,7 @@ GameObject:
   serializedVersion: 6
   m_Component:
   - component: {fileID: 1065150340}
-  m_Layer: 0
+  m_Layer: 10
   m_Name: Bone011
   m_TagString: Untagged
   m_Icon: {fileID: 0}
@@ -6680,7 +6680,7 @@ GameObject:
   - component: {fileID: 1085407718}
   - component: {fileID: 1085407720}
   - component: {fileID: 1085407719}
-  m_Layer: 0
+  m_Layer: 10
   m_Name: Cylinder002
   m_TagString: Untagged
   m_Icon: {fileID: 0}
@@ -7282,7 +7282,7 @@ GameObject:
   m_Component:
   - component: {fileID: 1182298075}
   - component: {fileID: 1182298076}
-  m_Layer: 0
+  m_Layer: 10
   m_Name: FPArms_Male
   m_TagString: Untagged
   m_Icon: {fileID: 0}
@@ -7569,7 +7569,7 @@ GameObject:
   - component: {fileID: 1195327001}
   - component: {fileID: 1195327003}
   - component: {fileID: 1195327002}
-  m_Layer: 0
+  m_Layer: 10
   m_Name: Bow
   m_TagString: Untagged
   m_Icon: {fileID: 0}
@@ -7816,7 +7816,7 @@ GameObject:
   serializedVersion: 6
   m_Component:
   - component: {fileID: 1256775562}
-  m_Layer: 0
+  m_Layer: 10
   m_Name: Bone015
   m_TagString: Untagged
   m_Icon: {fileID: 0}
@@ -8742,7 +8742,7 @@ GameObject:
   serializedVersion: 6
   m_Component:
   - component: {fileID: 1436868845}
-  m_Layer: 0
+  m_Layer: 10
   m_Name: Bone002
   m_TagString: Untagged
   m_Icon: {fileID: 0}
@@ -8775,7 +8775,7 @@ GameObject:
   - component: {fileID: 1446071868}
   - component: {fileID: 1446071870}
   - component: {fileID: 1446071869}
-  m_Layer: 0
+  m_Layer: 10
   m_Name: Capsule002
   m_TagString: Untagged
   m_Icon: {fileID: 0}
@@ -8855,7 +8855,7 @@ GameObject:
   serializedVersion: 6
   m_Component:
   - component: {fileID: 1461650662}
-  m_Layer: 0
+  m_Layer: 10
   m_Name: Bone017
   m_TagString: Untagged
   m_Icon: {fileID: 0}
@@ -8947,7 +8947,7 @@ GameObject:
   serializedVersion: 6
   m_Component:
   - component: {fileID: 1463569162}
-  m_Layer: 0
+  m_Layer: 10
   m_Name: Bone014
   m_TagString: Untagged
   m_Icon: {fileID: 0}
@@ -9053,7 +9053,7 @@ GameObject:
   serializedVersion: 6
   m_Component:
   - component: {fileID: 1500739982}
-  m_Layer: 0
+  m_Layer: 10
   m_Name: Bone008
   m_TagString: Untagged
   m_Icon: {fileID: 0}
@@ -9207,7 +9207,7 @@ GameObject:
   - component: {fileID: 1509906953}
   - component: {fileID: 1509906955}
   - component: {fileID: 1509906954}
-  m_Layer: 0
+  m_Layer: 10
   m_Name: Bow handle
   m_TagString: Untagged
   m_Icon: {fileID: 0}
@@ -9696,7 +9696,7 @@ GameObject:
   serializedVersion: 6
   m_Component:
   - component: {fileID: 1579340508}
-  m_Layer: 0
+  m_Layer: 10
   m_Name: Bone007
   m_TagString: Untagged
   m_Icon: {fileID: 0}
@@ -9802,7 +9802,7 @@ GameObject:
   serializedVersion: 6
   m_Component:
   - component: {fileID: 1664933276}
-  m_Layer: 0
+  m_Layer: 10
   m_Name: Bone009
   m_TagString: Untagged
   m_Icon: {fileID: 0}
@@ -10022,7 +10022,7 @@ GameObject:
   - component: {fileID: 1688919121}
   - component: {fileID: 1688919123}
   - component: {fileID: 1688919122}
-  m_Layer: 0
+  m_Layer: 10
   m_Name: Cylinder005
   m_TagString: Untagged
   m_Icon: {fileID: 0}
@@ -10265,7 +10265,7 @@ GameObject:
   serializedVersion: 6
   m_Component:
   - component: {fileID: 1759424523}
-  m_Layer: 0
+  m_Layer: 10
   m_Name: Bone018
   m_TagString: Untagged
   m_Icon: {fileID: 0}
@@ -10297,7 +10297,7 @@ GameObject:
   - component: {fileID: 1794096021}
   - component: {fileID: 1794096023}
   - component: {fileID: 1794096022}
-  m_Layer: 0
+  m_Layer: 10
   m_Name: Capsule001
   m_TagString: Untagged
   m_Icon: {fileID: 0}
@@ -10377,7 +10377,7 @@ GameObject:
   serializedVersion: 6
   m_Component:
   - component: {fileID: 1824967278}
-  m_Layer: 0
+  m_Layer: 10
   m_Name: arch
   m_TagString: Untagged
   m_Icon: {fileID: 0}
@@ -10876,7 +10876,7 @@ GameObject:
   serializedVersion: 6
   m_Component:
   - component: {fileID: 1921125347}
-  m_Layer: 0
+  m_Layer: 10
   m_Name: Bone013
   m_TagString: Untagged
   m_Icon: {fileID: 0}
@@ -11687,7 +11687,7 @@ GameObject:
   serializedVersion: 6
   m_Component:
   - component: {fileID: 2012922011}
-  m_Layer: 0
+  m_Layer: 10
   m_Name: Point002
   m_TagString: Untagged
   m_Icon: {fileID: 0}
@@ -11815,7 +11815,7 @@ Transform:
   m_PrefabAsset: {fileID: 0}
   m_GameObject: {fileID: 2018474322}
   m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
-  m_LocalPosition: {x: 0, y: 1, z: 0}
+  m_LocalPosition: {x: 0, y: 0, z: 0}
   m_LocalScale: {x: 1, y: 1, z: 1}
   m_Children: []
   m_Father: {fileID: 1957562168}
@@ -11861,7 +11861,7 @@ Camera:
   m_Depth: -1
   m_CullingMask:
     serializedVersion: 2
-    m_Bits: 4294967295
+    m_Bits: 4294966271
   m_RenderingPath: 1
   m_TargetTexture: {fileID: 0}
   m_TargetDisplay: 0
@@ -12125,7 +12125,7 @@ GameObject:
   - component: {fileID: 2031515110}
   - component: {fileID: 2031515112}
   - component: {fileID: 2031515111}
-  m_Layer: 0
+  m_Layer: 10
   m_Name: Capsule003
   m_TagString: Untagged
   m_Icon: {fileID: 0}
@@ -12596,6 +12596,36 @@ MonoBehaviour:
           m_StringArgument: 
           m_BoolArgument: 0
         m_CallState: 2
+--- !u!1 &2113407308
+GameObject:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  serializedVersion: 6
+  m_Component:
+  - component: {fileID: 2113407309}
+  m_Layer: 0
+  m_Name: DistanceFollow
+  m_TagString: Untagged
+  m_Icon: {fileID: 0}
+  m_NavMeshLayer: 0
+  m_StaticEditorFlags: 0
+  m_IsActive: 1
+--- !u!4 &2113407309
+Transform:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 2113407308}
+  m_LocalRotation: {x: 0, y: -0, z: -0, w: 1}
+  m_LocalPosition: {x: 0.0000000013367829, y: -0.23840448, z: 1.651}
+  m_LocalScale: {x: 1, y: 1, z: 1}
+  m_Children: []
+  m_Father: {fileID: 543450652801161733}
+  m_RootOrder: 6
+  m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
 --- !u!1 &2117937105
 GameObject:
   m_ObjectHideFlags: 0
@@ -13505,6 +13535,7 @@ Transform:
   - {fileID: 8661935025974191969}
   - {fileID: 1234548498}
   - {fileID: 1968182886}
+  - {fileID: 2113407309}
   m_Father: {fileID: 105398403}
   m_RootOrder: 11
   m_LocalEulerAnglesHint: {x: -90, y: 90, z: 0}

+ 1 - 0
Assets/BowArrow/Scripts/Effect/HitTargetNumber.cs

@@ -28,6 +28,7 @@ public class HitTargetNumber : MonoBehaviour
     }
 
     public static void Create(int number) {
+        if (number <= 0) return;
         GameObject o = GameObject.Instantiate(
             Resources.Load<GameObject>("Prefabs/Effects/HitTargetNumber"),
             Vector3.zero,

+ 28 - 3
Assets/BowArrow/Scripts/Game/ArmBow.cs

@@ -142,7 +142,10 @@ public class ArmBow : MonoBehaviour
             }
         }
         // 筛选出一个稳定的发射角度---end
-        GameObject arrowCopy = GameObject.Instantiate(this.arrow, this.bowCamera.transform.position, best_rotation);
+        Vector3 shootOutPosition = this.bowCamera.transform.position;
+        //如果弓指向太过朝下,在弓口发射可能会射穿地面,因此需要角度适当时,才从弓口射出。
+        if (BowCamera.ins.transform.localEulerAngles.x < 30) shootOutPosition += this.bowCamera.transform.forward * 1.5f;
+        GameObject arrowCopy = GameObject.Instantiate(this.arrow, shootOutPosition, best_rotation);
 
         Vector3 s1 = arrowCopy.transform.localScale;
         Vector3 s2 = bowCamera.transform.localScale;
@@ -152,12 +155,34 @@ public class ArmBow : MonoBehaviour
 
         Arrow arrowComp = arrowCopy.AddComponent<Arrow>();
         arrowComp.armBow = this;
+        arrowComp.shootOutPosition = shootOutPosition;
         // Arrow.speed = DebugBowPower.ins.getPowerPercent() * 100f;
         // Arrow.speed = BaseSpeedSlider.ins.getValue();
         // Arrow.speed = Mathf.Pow(ShootCheck.ins.shootSpeed, ShootCheck.ins.shootSpeed < 13 ? 2f: (ShootCheck.ins.shootSpeed < 15 ? 2.5f : 3.0f));
 
-        if (ShootCheck.ins && !GameMgr.debugInEditor) {
-            Arrow.speed = ShootCheck.ins.shootSpeed / 16 * 80; 
+        if (ShootCheck.ins && !GameMgr.debugInEditor) 
+        {
+            float accRange = LoginMgr.myUserInfo.deviceAccValue;
+            float pullDistance = ShootCheck.ins.shootSpeed / accRange * 36;
+            int bowPound = DeviceMgr.ins.GetCurrentBowPound();
+            if (bowPound == 18) 
+            {
+                float x = pullDistance;
+                double p1 = -1.188748333;
+                double p2 = 0.033890372;
+                double p3 = 3.408473747;
+                double y = 1 / (p1 + p2 * Mathf.Pow(x, 0.5f) * Mathf.Log(x) + p3 / Mathf.Pow(x, 0.5f));
+                Arrow.speed = GameMgr.RealSizeToGameSize((float) y);
+            } 
+            else if (bowPound == 25) 
+            {
+                float x = pullDistance;
+                double p1 = -1.567293395;
+                double p2 = 0.039774484;
+                double p3 = 4.73453844;
+                double y = 1 / (p1 + p2 * Mathf.Pow(x, 0.5f) * Mathf.Log(x) + p3 / Mathf.Pow(x, 0.5f));
+                Arrow.speed = GameMgr.RealSizeToGameSize((float) y);
+            }
         }   
 
         arrowCopy.SetActive(true);  

+ 15 - 59
Assets/BowArrow/Scripts/Game/Arrow.cs

@@ -5,10 +5,11 @@ using DG.Tweening;
 public class Arrow : MonoBehaviour
 {
     private Rigidbody newRigidbody;
+    public Vector3 shootOutPosition;
     public float flyTime = 0;
     public bool isHit = false;
     public ArmBow armBow;
-    public static float speed = 40;
+    public static float speed = GameMgr.RealSizeToGameSize(140);
 
     void Awake()
     {
@@ -24,8 +25,10 @@ public class Arrow : MonoBehaviour
         } 
         newRigidbody.velocity = this.transform.forward * speedCopy;
         newRigidbody.collisionDetectionMode = CollisionDetectionMode.ContinuousDynamic;
-
-        this.transform.Find("Camera").gameObject.SetActive(true);
+        
+        Transform cameraTF = this.transform.Find("Camera");
+        cameraTF.gameObject.SetActive(true);
+        cameraTF.gameObject.AddComponent<ArrowCamera>().arrow = this;
 
         this.activeEffectCyclone(true);
         this.activeEffectTrail(true);
@@ -59,8 +62,7 @@ public class Arrow : MonoBehaviour
             }
             this.UpdateRotate();
         }
-        this.UpdateShake();
-        this.updateMoveCamera();
+        // this.UpdateShake();
     }
 
     public void Hit() {
@@ -76,6 +78,8 @@ public class Arrow : MonoBehaviour
         this.activeEffectCyclone(false);
         this.activeEffectBomb(true);
         this.activeEffectTrail(false);
+        Debug.Log("Speed " + GameMgr.GameSizeToRealSize(Arrow.speed));
+        Debug.Log("Distance " + GameMgr.GameSizeToRealSize(Vector3.Distance(this.getHeadPosition(), shootOutPosition)));
     }
 
     public Vector3 getHeadPosition() {
@@ -121,59 +125,11 @@ public class Arrow : MonoBehaviour
         this.shakeTime += Time.deltaTime;
     }
 
-    /**相机移动 */
-    private Vector3 cameraPosition = new Vector3();
-    private bool cameraMoveFinish = false;
-    //相机的位置xyz变化 【变化量,最小值,最大值】
-    private float[] cpcs = {
-        //运动中
-        0, 0, 0,
-        1.5f, 0, 0.25f,
-        -7, -1.5f, 0,
-        //击中后
-        -3.5f, -1.2f, 0,
-        -3.5f, 0, 0.5f,
-        7, -1.5f, -1.5f
-    };
-
-    private void updateMoveCamera() {
-        if (cameraMoveFinish) {
-            return;
-        }
-        Transform cameraT = this.transform.Find("Camera");
-        cameraPosition.x = cameraT.localPosition.x;
-        cameraPosition.y = cameraT.localPosition.y;
-        cameraPosition.z = cameraT.localPosition.z;
-        if (this.isHit) {
-            cameraPosition.x = Mathf.Clamp(cameraPosition.x + this.cpcs[9] * Time.deltaTime, this.cpcs[10], this.cpcs[11]);
-            cameraPosition.y = Mathf.Clamp(cameraPosition.y + this.cpcs[12] * Time.deltaTime, this.cpcs[13], this.cpcs[14]);
-            cameraPosition.z = Mathf.Clamp(cameraPosition.z + this.cpcs[15] * Time.deltaTime, this.cpcs[16], this.cpcs[17]);
-            float d = Vector3.Distance(cameraPosition, new Vector3(
-                this.cpcs[9] < 0 ? this.cpcs[10]: this.cpcs[11], 
-                this.cpcs[12] < 0 ? this.cpcs[13]: this.cpcs[14], 
-                this.cpcs[15] < 0 ? this.cpcs[16]: this.cpcs[17]
-            ));
-            if (d < 0.001f) {
-                cameraMoveFinish = true;
-                Sequence seq = DOTween.Sequence();
-                seq.AppendInterval(1.0f);
-                seq.AppendCallback(delegate() {
-                    nextShoot();
-                    Destroy(cameraT.gameObject);
-                    this.enabled = false;
-                });
-            }
-        } else {
-            cameraPosition.x = Mathf.Clamp(cameraPosition.y + this.cpcs[0] * Time.deltaTime, this.cpcs[1], this.cpcs[2]);
-            cameraPosition.y = Mathf.Clamp(cameraPosition.y + this.cpcs[3] * Time.deltaTime, this.cpcs[4], this.cpcs[5]);
-            cameraPosition.z = Mathf.Clamp(cameraPosition.z + this.cpcs[6] * Time.deltaTime, this.cpcs[7], this.cpcs[8]);
-        }
-        cameraT.localPosition = cameraPosition;
-        cameraT.LookAt(this.transform.Find("Head"));
-    }
-
-    /**延时方法 */
+    //进入下一轮射击
+    bool hasDoneNextShoot = false;
     public void nextShoot() {
+        if (hasDoneNextShoot) return;
+        hasDoneNextShoot = true;
         GameMgr.ins.gameMode.ResumeTimeCounting(this);
         if (!GameMgr.ins.gameMode.DoNextShoot()) return;
         this.armBow.readyShoot();
@@ -211,11 +167,11 @@ public class Arrow : MonoBehaviour
         DOTween.To(() => ps.minParticleSize, value => {
             ps.minParticleSize = value;
             ps.maxParticleSize = value;
-        }, 0.6f, 0.6f);
+        }, 0.4f, 0.6f);
         DOTween.To(() => ps1.minParticleSize, value => {
             ps1.minParticleSize = value;
             ps1.maxParticleSize = value;
-        }, 1.2f, 0.6f);
+        }, 0.8f, 0.6f);
     }
 
     void activeEffectBomb(bool value) 

+ 128 - 0
Assets/BowArrow/Scripts/Game/ArrowCamera.cs

@@ -0,0 +1,128 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+using DG.Tweening;
+
+public class ArrowCamera : MonoBehaviour
+{
+    public Arrow arrow;
+
+    void Start()
+    {
+        
+    }
+
+    void FixedUpdate()
+    {
+        updateMoveCamera(); 
+    }
+
+    /**相机移动 */
+    private bool cameraMoveFinish = false;
+    //相机的位置xyz变化 【每秒变化量,最小值,最大值】
+    private float[] cpcs = {
+        //运动中
+        6, 0, 0.4f,
+        6, 0, 0.2f,
+        -18f, -1 - Mathf.Clamp(Arrow.speed / 20 * 6, 0, 6), 0,
+        //击中后
+        -3.5f, -0.6f, 0.4f,
+        -3.5f, 0.1f, 0.2f,
+        30, -1 - Mathf.Clamp(Arrow.speed / 20 * 6, 0, 6), -0.8f
+    };
+
+    private void updateMoveCamera() {
+        if (cameraMoveFinish) {
+            return;
+        }
+        Transform cameraT = this.transform;
+        Vector3 cameraPosition = cameraT.localPosition;
+        if (arrow.isHit) {
+            cameraPosition.x = Mathf.Clamp(cameraPosition.x + this.cpcs[9] * Time.deltaTime, this.cpcs[10], this.cpcs[11]);
+            cameraPosition.y = Mathf.Clamp(cameraPosition.y + this.cpcs[12] * Time.deltaTime, this.cpcs[13], this.cpcs[14]);
+            cameraPosition.z = Mathf.Clamp(cameraPosition.z + this.cpcs[15] * Time.deltaTime, this.cpcs[16], this.cpcs[17]);
+            float d = Vector3.Distance(cameraPosition, new Vector3(
+                this.cpcs[9] < 0 ? this.cpcs[10]: this.cpcs[11], 
+                this.cpcs[12] < 0 ? this.cpcs[13]: this.cpcs[14], 
+                this.cpcs[15] < 0 ? this.cpcs[16]: this.cpcs[17]
+            ));
+            if (d < 0.001f) {
+                cameraMoveFinish = true;
+                Sequence seq = DOTween.Sequence();
+                seq.AppendInterval(1.0f);
+                seq.AppendCallback(delegate() {
+                    arrow.nextShoot();
+                    Destroy(cameraT.gameObject);
+                    this.enabled = false;
+                });
+            }
+        } else {
+            cameraPosition.x = Mathf.Clamp(cameraPosition.x + this.cpcs[0] * Time.deltaTime, this.cpcs[1], this.cpcs[2]);
+            cameraPosition.y = Mathf.Clamp(cameraPosition.y + this.cpcs[3] * Time.deltaTime, this.cpcs[4], this.cpcs[5]);
+            cameraPosition.z = Mathf.Clamp(cameraPosition.z + this.cpcs[6] * Time.deltaTime, this.cpcs[7], this.cpcs[8]);
+        }
+        cameraT.localPosition = cameraPosition;
+        cameraT.LookAt(arrow.transform.Find("Head"));
+    }
+}
+
+// public class ArrowCamera : MonoBehaviour
+// {
+//     public Arrow arrow;
+
+//     void FixedUpdate()
+//     {
+//         updateMoveCamera(); 
+//     }
+
+//     /**相机移动 */
+//     private Vector3 cameraPosition = new Vector3();
+//     private bool cameraMoveFinish = false;
+//     //相机的位置xyz变化 【每秒变化量,最小值,最大值】
+//     private float[] cpcs = {
+//         //运动中
+//         0, 0, 0,
+//         1.5f, 0, 0.25f,
+//         -7, -1.5f, 0,
+//         //击中后
+//         -3.5f, -1.2f, 0,
+//         -3.5f, 0, 0.5f,
+//         7, -1.5f, -1.5f
+//     };
+
+//     private void updateMoveCamera() {
+//         if (cameraMoveFinish) {
+//             return;
+//         }
+//         Transform cameraT = this.transform;
+//         cameraPosition.x = cameraT.localPosition.x;
+//         cameraPosition.y = cameraT.localPosition.y;
+//         cameraPosition.z = cameraT.localPosition.z;
+//         if (arrow.isHit) {
+//             cameraPosition.x = Mathf.Clamp(cameraPosition.x + this.cpcs[9] * Time.deltaTime, this.cpcs[10], this.cpcs[11]);
+//             cameraPosition.y = Mathf.Clamp(cameraPosition.y + this.cpcs[12] * Time.deltaTime, this.cpcs[13], this.cpcs[14]);
+//             cameraPosition.z = Mathf.Clamp(cameraPosition.z + this.cpcs[15] * Time.deltaTime, this.cpcs[16], this.cpcs[17]);
+//             float d = Vector3.Distance(cameraPosition, new Vector3(
+//                 this.cpcs[9] < 0 ? this.cpcs[10]: this.cpcs[11], 
+//                 this.cpcs[12] < 0 ? this.cpcs[13]: this.cpcs[14], 
+//                 this.cpcs[15] < 0 ? this.cpcs[16]: this.cpcs[17]
+//             ));
+//             if (d < 0.001f) {
+//                 cameraMoveFinish = true;
+//                 Sequence seq = DOTween.Sequence();
+//                 seq.AppendInterval(1.0f);
+//                 seq.AppendCallback(delegate() {
+//                     arrow.nextShoot();
+//                     Destroy(cameraT.gameObject);
+//                     this.enabled = false;
+//                 });
+//             }
+//         } else {
+//             cameraPosition.x = Mathf.Clamp(cameraPosition.y + this.cpcs[0] * Time.deltaTime, this.cpcs[1], this.cpcs[2]);
+//             cameraPosition.y = Mathf.Clamp(cameraPosition.y + this.cpcs[3] * Time.deltaTime, this.cpcs[4], this.cpcs[5]);
+//             cameraPosition.z = Mathf.Clamp(cameraPosition.z + this.cpcs[6] * Time.deltaTime, this.cpcs[7], this.cpcs[8]);
+//         }
+//         cameraT.localPosition = cameraPosition;
+//         cameraT.LookAt(arrow.transform.Find("Head"));
+//     }
+// }

+ 11 - 0
Assets/BowArrow/Scripts/Game/ArrowCamera.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 257809d1e953c5542a22bd5058ccb93d
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 5 - 0
Assets/BowArrow/Scripts/Game/BowCamera.cs

@@ -12,6 +12,11 @@ public class BowCamera : MonoBehaviour
     // 用于禁止相机旋转外部接口
     public bool banRotate = false;
     public bool banCameraFieldOfView = false;
+    public static BowCamera ins;
+
+    void Awake() {
+        ins = this;
+    }
 
     void Update()
     {

+ 1 - 1
Assets/BowArrow/Scripts/Game/TargetBody.cs

@@ -41,7 +41,7 @@ public class TargetBody : MonoBehaviour
     public void SetDistance(float value) {
         distance = value;
         Vector3 v3 = this.transform.parent.localPosition;
-        v3.x = 7.718f + (-17.12f - 7.718f) * ((value - 10f) / 60f);
+        v3.x = 11.85766f - GameMgr.RealSizeToGameSize(value);
         this.transform.parent.localPosition = v3;
     }
 

+ 19 - 2
Assets/BowArrow/Scripts/Manager/DeviceMgr.cs

@@ -90,6 +90,18 @@ public class DeviceMgr
         }
         return (bow, arrow);
     }
+    public int GetCurrentBowPound()
+    {
+        List<DeviceInfo> myDevices = GetMyDeviceList();
+        foreach (var myDevice in myDevices)
+        {
+            if (myDevice.config.type == 1 && myDevice.inuse)
+            {
+                return ((DeviceBowConfig) myDevice.config).pound;
+            }
+        }
+        return 0;
+    }
 }
 public class DeviceInfo
 {
@@ -107,7 +119,10 @@ public class DeviceConfig
     public int model = 0;
     public int type = 0;
 }
-public class DeviceBow1000 : DeviceConfig {
+public class DeviceBowConfig : DeviceConfig {
+    public int pound = 0;
+}
+public class DeviceBow1000 : DeviceBowConfig {
     public DeviceBow1000()
     {
         id = 1000;
@@ -116,9 +131,10 @@ public class DeviceBow1000 : DeviceConfig {
         difficulty = 3;
         model = 1;
         type = 1;
+        pound = 18;
     }
 }
-public class DeviceBow1001 : DeviceConfig {
+public class DeviceBow1001 : DeviceBowConfig {
     public DeviceBow1001()
     {
         id = 1001;
@@ -127,6 +143,7 @@ public class DeviceBow1001 : DeviceConfig {
         difficulty = 5;
         model = 1;
         type = 1;
+        pound = 25;
     }
 }
 public class DeviceArrow2000 : DeviceConfig {

+ 11 - 4
Assets/BowArrow/Scripts/Manager/GameMgr.cs

@@ -107,6 +107,16 @@ public class GameMgr : MonoBehaviour
             Time.timeScale = 1;
         }
     }
+    //现实的计量值转游戏场景的计量值(米)
+    public static float RealSizeToGameSize(float realSize)
+    {
+        return realSize * 0.413966f;
+    }
+    //游戏场景的计量值转现实的计量值(米)
+    public static float GameSizeToRealSize(float gameSize)
+    {
+        return gameSize / 0.413966f;
+    }
 }
 
 public abstract class GameMode 
@@ -291,10 +301,7 @@ public class PKGameMode : GameMode {
     public override void HitTarget(int score) {
         currentScores[currentPlayerID - 1] += score;
         shootCount++;
-        if (score > 0)
-        {
-            HitTargetNumber.Create(score);
-        }
+        HitTargetNumber.Create(score);
     }
 
     public override bool DoNextShoot() {

+ 1 - 1
ProjectSettings/DynamicsManager.asset

@@ -4,7 +4,7 @@
 PhysicsManager:
   m_ObjectHideFlags: 0
   serializedVersion: 13
-  m_Gravity: {x: 0, y: -4.81, z: 0}
+  m_Gravity: {x: 0, y: -12.48, z: 0}
   m_DefaultMaterial: {fileID: 0}
   m_BounceThreshold: 2
   m_DefaultMaxDepenetrationVelocity: 10

+ 1 - 1
ProjectSettings/TagManager.asset

@@ -15,7 +15,7 @@ TagManager:
   - 
   - Target
   - ellipse
-  - 
+  - ArmBow
   - 
   - 
   -