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

更新射箭小游戏

parent f4dc446a
This diff is collapsed.
......@@ -8,7 +8,7 @@ public class ArrowController : MonoBehaviour
// Start is called before the first frame update
public GameObject arrowPrefab;
public GameObject arrowPlace;
//public GameObject arrowPlace;
public GameObject arrowTrigger;
public GameObject arrowBack;
public Vector3 arrowHeading;
......@@ -16,9 +16,7 @@ public class ArrowController : MonoBehaviour
public bool waitingToShoot = false;
void Start()
{
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");
//arrowPlace = GameObject.Find("XR Interaction Setup/XR Origin (XR Rig)/Camera Offset/Main Camera/ArrowPlace");
}
// Update is called once per frame
......@@ -35,9 +33,8 @@ public class ArrowController : MonoBehaviour
public void GrabArrow()
{
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;
//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;
}
public void ReleaseArrow()
......
......@@ -28,7 +28,7 @@ public class BowController : MonoBehaviour
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.GetComponent<Rigidbody>().velocity = new Vector3(0, 0, 0);
stringMiddlePoint.GetComponent<Rigidbody>().angularVelocity = new Vector3(0, 0, 0);
......
......@@ -36,6 +36,7 @@ public class PullMeasurer : XRBaseInteractable
// 计算新的拉伸程度,并返回它在空间中的位置
PullAmount = CalculatePull(interactorPosition);
}
private float CalculatePull(Vector3 pullPosition)
......
......@@ -9,6 +9,8 @@ TagManager:
- Destroyer
- MiniWorldCamera
- Water
- Arrow
- ArrowTip
layers:
- Default
- 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