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

更新

parent ffa1abd5
This diff is collapsed.
This diff is collapsed.
fileFormatVersion: 2
guid: 282e7966c9781324a8655c830e7bbc21
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
...@@ -4,7 +4,7 @@ using UnityEngine; ...@@ -4,7 +4,7 @@ using UnityEngine;
using UnityEngine.XR.Interaction.Toolkit; using UnityEngine.XR.Interaction.Toolkit;
/// <summary> /// <summary>
/// 更新人物碰撞体的位置 /// 更新人物碰撞体的位置(当玩家蹲下或跳起的时候)
/// </summary> /// </summary>
public class CustomCharacterControllerDriver : CharacterControllerDriver public class CustomCharacterControllerDriver : CharacterControllerDriver
{ {
......
fileFormatVersion: 2
guid: 11596f8294e85e044a5b8f5c8a687d6c
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 9a42f6b5fc011c14d8224f50174c3731
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 9e53b40a05a972143b75742019717fed
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
...@@ -3,25 +3,28 @@ using System.Collections.Generic; ...@@ -3,25 +3,28 @@ using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using UnityEngine.XR.Interaction.Toolkit; using UnityEngine.XR.Interaction.Toolkit;
/// <summary>
/// 弓箭控制器
/// </summary>
public class ArrowController : MonoBehaviour public class ArrowController : MonoBehaviour
{ {
// Start is called before the first frame update //[Tooltip("弓箭的预制体")]
//public GameObject arrowPrefab;
public GameObject arrowPrefab; //[Tooltip("弓箭生成的地方")]
//public GameObject arrowPlace; //public GameObject arrowPlace;
[Tooltip("弓箭搭载到弓的地方")]
public GameObject arrowTrigger; public GameObject arrowTrigger;
[Tooltip("弓箭返回的地方")]
public GameObject arrowBack; public GameObject arrowBack;
[Tooltip("弓箭的朝向")]
public Vector3 arrowHeading; public Vector3 arrowHeading;
[Tooltip("弓箭是否可以发射")]
public bool waitingToShoot = false; public bool waitingToShoot = false;
void Start()
{
//arrowPlace = GameObject.Find("XR Interaction Setup/XR Origin (XR Rig)/Camera Offset/Main Camera/ArrowPlace");
}
// Update is called once per frame // Update is called once per frame
void Update() void Update()
{ {
//更新弓箭搭载在弓上的位置
arrowHeading = arrowTrigger.transform.position - arrowBack.transform.position; arrowHeading = arrowTrigger.transform.position - arrowBack.transform.position;
if (waitingToShoot) if (waitingToShoot)
{ {
...@@ -30,13 +33,16 @@ public class ArrowController : MonoBehaviour ...@@ -30,13 +33,16 @@ public class ArrowController : MonoBehaviour
} }
} }
/// <summary>
/// 用于无限生成弓箭
/// </summary>
//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;
//}
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;
}
public void ReleaseArrow() public void ReleaseArrow()
{ {
gameObject.GetComponent<Rigidbody>().useGravity = true; gameObject.GetComponent<Rigidbody>().useGravity = true;
...@@ -48,8 +54,6 @@ public class ArrowController : MonoBehaviour ...@@ -48,8 +54,6 @@ public class ArrowController : MonoBehaviour
gameObject.transform.parent = arrowTrigger.transform; gameObject.transform.parent = arrowTrigger.transform;
waitingToShoot = true; waitingToShoot = true;
} }
Debug.Log("ReleaseArrow:" + gameObject.transform.parent);
} }
void OnTriggerEnter(Collider other) void OnTriggerEnter(Collider other)
......
...@@ -5,27 +5,22 @@ using UnityEngine.UI; ...@@ -5,27 +5,22 @@ using UnityEngine.UI;
using TMPro; using TMPro;
using UnityEngine.Events; using UnityEngine.Events;
/// <summary>
/// 弓箭射中箭靶
/// </summary>
public class ArrowScore : MonoBehaviour public class ArrowScore : MonoBehaviour
{ {
[Tooltip("提示文本")] [Tooltip("提示文本")]
public TMP_Text text_Tip; public TMP_Text text_Tip;
[Tooltip("箭靶中心点(用于计算得分)")]
// Start is called before the first frame update
public GameObject targetCenter; public GameObject targetCenter;
[Tooltip("集中触发事件")]
public UnityEvent ArrowOnEvent; public UnityEvent ArrowOnEvent;
void Start() /// <summary>
{ /// 计算得分和触发击中事件
/// </summary>
} /// <param name="collider"></param>
// Update is called once per frame
void Update()
{
}
void OnTriggerEnter(Collider collider) void OnTriggerEnter(Collider collider)
{ {
if (collider.tag == "Arrow") if (collider.tag == "Arrow")
......
...@@ -4,7 +4,9 @@ using UnityEngine; ...@@ -4,7 +4,9 @@ using UnityEngine;
public class ArrowTrigger : MonoBehaviour public class ArrowTrigger : MonoBehaviour
{ {
[Tooltip("保存当前箭是否被箭托触发器触发,并存储触发的箭对象")]
public GameObject arrowOnBow; public GameObject arrowOnBow;
[Tooltip("标记当前箭是否处于箭托触发器内部")]
private bool arrowStatus; private bool arrowStatus;
void OnTriggerEnter(Collider other) void OnTriggerEnter(Collider other)
......
...@@ -8,30 +8,27 @@ using UnityEngine.Events; ...@@ -8,30 +8,27 @@ using UnityEngine.Events;
/// </summary> /// </summary>
public class BowController : MonoBehaviour public class BowController : MonoBehaviour
{ {
[Tooltip("箭的发射速度")]
public float arrowSpeed = 400; public float arrowSpeed = 400;
[Tooltip("箭托触发器")]
public GameObject arrowTrigger; public GameObject arrowTrigger;
[Tooltip("箭搭载点")]
public GameObject arrowAttachedPoint; public GameObject arrowAttachedPoint;
[Tooltip("弓弦初始点")]
public GameObject stringStartPoint; public GameObject stringStartPoint;
[Tooltip("弓弦末端")]
public GameObject stringEndPoint; public GameObject stringEndPoint;
[Tooltip("弓弦中心点")]
public GameObject stringMiddlePoint; public GameObject stringMiddlePoint;
[Tooltip("弓箭发射出发事件")]
public UnityEvent ArrowOnEvent; public UnityEvent ArrowOnEvent;
// Start is called before the first frame update /// <summary>
void Start() /// 释放弓弦,发射箭
{ /// </summary>
}
// Update is called once per frame
void Update()
{
}
public void ReleaseString() public void 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);
......
fileFormatVersion: 2
guid: 5d603c08ab62c7f4c84d0ca40ee7ee08
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: ccefe2de7e150544280f2d61bf8f1d37
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 55c835296dc895b48b483e36b7991ed7
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 7a48928f9177a8e4ea3299dbbdb528ad
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 961d2bb484f418c4a8a7fd2cfdbd5da0
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
...@@ -59,10 +59,10 @@ AnimatorStateMachine: ...@@ -59,10 +59,10 @@ AnimatorStateMachine:
m_ChildStates: m_ChildStates:
- serializedVersion: 1 - serializedVersion: 1
m_State: {fileID: -5373289927847206711} m_State: {fileID: -5373289927847206711}
m_Position: {x: 300, y: 190, z: 0} m_Position: {x: 340, y: 200, z: 0}
- serializedVersion: 1 - serializedVersion: 1
m_State: {fileID: 4282061337827641718} m_State: {fileID: 4282061337827641718}
m_Position: {x: 330, y: 90, z: 0} m_Position: {x: 360, y: 110, z: 0}
- serializedVersion: 1 - serializedVersion: 1
m_State: {fileID: 8482386419465628447} m_State: {fileID: 8482386419465628447}
m_Position: {x: 326, y: 39, z: 0} m_Position: {x: 326, y: 39, z: 0}
......
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