Commit f7835182 authored by 杨泽宇's avatar 杨泽宇

更新射箭小游戏

parent f4dc446a
This diff is collapsed.
...@@ -8,7 +8,7 @@ public class ArrowController : MonoBehaviour ...@@ -8,7 +8,7 @@ public class ArrowController : MonoBehaviour
// Start is called before the first frame update // Start is called before the first frame update
public GameObject arrowPrefab; public GameObject arrowPrefab;
public GameObject arrowPlace; //public GameObject arrowPlace;
public GameObject arrowTrigger; public GameObject arrowTrigger;
public GameObject arrowBack; public GameObject arrowBack;
public Vector3 arrowHeading; public Vector3 arrowHeading;
...@@ -16,9 +16,7 @@ public class ArrowController : MonoBehaviour ...@@ -16,9 +16,7 @@ public class ArrowController : MonoBehaviour
public bool waitingToShoot = false; public bool waitingToShoot = false;
void Start() void Start()
{ {
arrowPlace = GameObject.Find("XR Interaction Setup/XR Origin (XR Rig)/Camera Offset/Main Camera/ArrowPlace"); //arrowPlace = GameObject.Find("XR Interaction Setup/XR Origin (XR Rig)/Camera Offset/Main Camera/ArrowPlace");
arrowTrigger = GameObject.Find("Bow/ArrowTrigger");
arrowBack = GameObject.Find("Bow/String/Notch");
} }
// Update is called once per frame // Update is called once per frame
...@@ -35,9 +33,8 @@ public class ArrowController : MonoBehaviour ...@@ -35,9 +33,8 @@ public class ArrowController : MonoBehaviour
public void GrabArrow() public void GrabArrow()
{ {
//GameObject arrow = Instantiate(arrowPrefab, arrowPlace.transform.position, arrowPlace.transform.rotation);
GameObject arrow = Instantiate(arrowPrefab, arrowPlace.transform.position, arrowPlace.transform.rotation); //arrow.transform.parent = GameObject.Find("XR Interaction Setup/XR Origin (XR Rig)/Camera Offset/Main Camera").transform;
arrow.transform.parent = GameObject.Find("XR Interaction Setup/XR Origin (XR Rig)/Camera Offset/Main Camera").transform;
} }
public void ReleaseArrow() public void ReleaseArrow()
......
...@@ -28,7 +28,7 @@ public class BowController : MonoBehaviour ...@@ -28,7 +28,7 @@ public class BowController : MonoBehaviour
public void ReleaseString() public void ReleaseString()
{ {
Debug.Log("ReleaseString"); //Debug.Log("ReleaseString");
stringMiddlePoint.transform.position = (stringStartPoint.transform.position + stringEndPoint.transform.position + new Vector3(0, 0.07f, 0)) / 2; stringMiddlePoint.transform.position = (stringStartPoint.transform.position + stringEndPoint.transform.position + new Vector3(0, 0.07f, 0)) / 2;
stringMiddlePoint.GetComponent<Rigidbody>().velocity = new Vector3(0, 0, 0); stringMiddlePoint.GetComponent<Rigidbody>().velocity = new Vector3(0, 0, 0);
stringMiddlePoint.GetComponent<Rigidbody>().angularVelocity = new Vector3(0, 0, 0); stringMiddlePoint.GetComponent<Rigidbody>().angularVelocity = new Vector3(0, 0, 0);
......
...@@ -36,6 +36,7 @@ public class PullMeasurer : XRBaseInteractable ...@@ -36,6 +36,7 @@ public class PullMeasurer : XRBaseInteractable
// 计算新的拉伸程度,并返回它在空间中的位置 // 计算新的拉伸程度,并返回它在空间中的位置
PullAmount = CalculatePull(interactorPosition); PullAmount = CalculatePull(interactorPosition);
} }
private float CalculatePull(Vector3 pullPosition) private float CalculatePull(Vector3 pullPosition)
......
...@@ -9,6 +9,8 @@ TagManager: ...@@ -9,6 +9,8 @@ TagManager:
- Destroyer - Destroyer
- MiniWorldCamera - MiniWorldCamera
- Water - Water
- Arrow
- ArrowTip
layers: layers:
- Default - Default
- TransparentFX - TransparentFX
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment