From 4ce3d1600c3878c43c96a32711b3f5d67919b1ce Mon Sep 17 00:00:00 2001 From: GamerHJD <491799022@qq.com> Date: Mon, 10 Jan 2022 16:29:53 +0800 Subject: [PATCH] =?UTF-8?q?WebGL=E5=88=9D=E5=A7=8B=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Resource/Prefab/Car_1.prefab | 20 +++++++++++++++++--- Assets/Script/GameRoot.cs | 2 +- Assets/Script/System/CarSys.cs | 1 + Assets/Script/Tool/DriveState.cs | 29 +++++++++++++++++++++++++++++ 4 files changed, 48 insertions(+), 4 deletions(-) create mode 100644 Assets/Script/Tool/DriveState.cs diff --git a/Assets/Resource/Prefab/Car_1.prefab b/Assets/Resource/Prefab/Car_1.prefab index fc90cbb..31f14f2 100644 --- a/Assets/Resource/Prefab/Car_1.prefab +++ b/Assets/Resource/Prefab/Car_1.prefab @@ -498,6 +498,7 @@ GameObject: - component: {fileID: 1317834824} - component: {fileID: 2997252462601936660} - component: {fileID: 4806489167474073388} + - component: {fileID: 3733720769268392713} m_Layer: 0 m_Name: Car_1 m_TagString: Car @@ -559,8 +560,8 @@ BoxCollider: m_IsTrigger: 1 m_Enabled: 1 serializedVersion: 2 - m_Size: {x: 3, y: 1, z: 10} - m_Center: {x: 0, y: 0.74, z: 6.99} + m_Size: {x: 3.5188322, y: 1, z: 8.888192} + m_Center: {x: 0.2594161, y: 0.74, z: 6.434096} --- !u!54 &4806489167474073388 Rigidbody: m_ObjectHideFlags: 0 @@ -573,10 +574,23 @@ Rigidbody: m_Drag: 0 m_AngularDrag: 0.05 m_UseGravity: 1 - m_IsKinematic: 1 + m_IsKinematic: 0 m_Interpolate: 0 m_Constraints: 0 m_CollisionDetection: 0 +--- !u!65 &3733720769268392713 +BoxCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5940721742220849789} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + serializedVersion: 2 + m_Size: {x: 1.7861338, y: 2.6640887, z: 5.044007} + m_Center: {x: 0.39306688, y: 1.3077829, z: -1.2198503} --- !u!1 &5940721742220849791 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Script/GameRoot.cs b/Assets/Script/GameRoot.cs index d3fc611..32ec37d 100644 --- a/Assets/Script/GameRoot.cs +++ b/Assets/Script/GameRoot.cs @@ -28,7 +28,7 @@ public class GameRoot : MonoBehaviour private void Update() { - carSys.CreatCar(0.5f);//每n秒随机出发点创建汽车 + carSys.CreatCar(1);//每n秒随机出发点创建汽车 roadSys.RoadStateUpdate(3);//每n秒检测路段状态 } } diff --git a/Assets/Script/System/CarSys.cs b/Assets/Script/System/CarSys.cs index 932f55f..0c8ff63 100644 --- a/Assets/Script/System/CarSys.cs +++ b/Assets/Script/System/CarSys.cs @@ -99,6 +99,7 @@ public class CarSys : MonoBehaviour //回收车辆 Destroy(agent.gameObject); + GameRoot.Instance.infoWnd.SetCarText(-1); } } diff --git a/Assets/Script/Tool/DriveState.cs b/Assets/Script/Tool/DriveState.cs new file mode 100644 index 0000000..a945a29 --- /dev/null +++ b/Assets/Script/Tool/DriveState.cs @@ -0,0 +1,29 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class DriveState : MonoBehaviour +{ + // Start is called before the first frame update + void Start() + { + + } + + // Update is called once per frame + void Update() + { + + } + + + private void OnTriggerEnter(Collider other) + { + Debug.Log("1"); + } + + private void OnTriggerExit(Collider other) + { + + } +}