This commit is contained in:
wuyanchen 2025-12-01 11:34:43 +08:00
parent dd2fbdb23f
commit f30a720139
16 changed files with 1783 additions and 1 deletions

View File

@ -88,7 +88,9 @@ public class CameraController : MonoBehaviour
rotateAction.action.performed += OnRotatePerformed;
rotateAction.action.canceled += OnRotateCanceled;
#if UNITY_WEBGL && !UNITY_EDITOR
WX.OnWheel(WxWheel);
#endif
//uiPointerAction.action.performed += OnUIPointerPerformed;
@ -156,8 +158,9 @@ public class CameraController : MonoBehaviour
rotateAction.action.performed -= OnRotatePerformed;
rotateAction.action.canceled -= OnRotateCanceled;
#if UNITY_WEBGL && !UNITY_EDITOR
WX.OffWheel(WxWheel);
#endif
//uiPointerAction.action.performed -= OnUIPointerPerformed;
}

8
Assets/ZuMa.meta Normal file
View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 9c9313f085daeff4dbed498c63943d0b
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 562213d3b1d7f614ca22466879d2f1b6
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,126 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Mat_Qiu
m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3}
m_ValidKeywords: []
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap:
RenderType: Opaque
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BaseMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _SpecGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_Lightmaps:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_LightmapsInd:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_ShadowMasks:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _AlphaClip: 0
- _Blend: 0
- _BumpScale: 1
- _ClearCoatMask: 0
- _ClearCoatSmoothness: 0
- _Cull: 2
- _Cutoff: 0.5
- _DetailAlbedoMapScale: 1
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _EnvironmentReflections: 1
- _GlossMapScale: 0
- _Glossiness: 0
- _GlossyReflections: 0
- _Metallic: 0
- _OcclusionStrength: 1
- _Parallax: 0.005
- _QueueOffset: 0
- _ReceiveShadows: 1
- _Smoothness: 0.5
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _Surface: 0
- _WorkflowMode: 1
- _ZWrite: 1
m_Colors:
- _BaseColor: {r: 0, g: 0.5868497, b: 1, a: 1}
- _Color: {r: 0, g: 0.5868497, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
m_BuildTextureStacks: []
--- !u!114 &842959082343887315
MonoBehaviour:
m_ObjectHideFlags: 11
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3}
m_Name:
m_EditorClassIdentifier:
version: 5

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 28f0721d933617844b8febe8e7dfd981
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

8
Assets/ZuMa/Prefabs.meta Normal file
View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 3ae0316c380891b46b3f00e673028e8b
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,130 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &110186699040962235
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 110186699040962234}
- component: {fileID: 110186699040962231}
- component: {fileID: 110186699040962232}
- component: {fileID: 110186699040962233}
- component: {fileID: 110186699040962230}
- component: {fileID: -8135213758794226317}
m_Layer: 0
m_Name: Qiu
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &110186699040962234
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 110186699040962235}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 3.5, y: 0, z: 3.5}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!33 &110186699040962231
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 110186699040962235}
m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0}
--- !u!23 &110186699040962232
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 110186699040962235}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 28f0721d933617844b8febe8e7dfd981, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_AdditionalVertexStreams: {fileID: 0}
--- !u!135 &110186699040962233
SphereCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 110186699040962235}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 2
m_Radius: 0.5
m_Center: {x: 0, y: 0, z: 0}
--- !u!54 &110186699040962230
Rigidbody:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 110186699040962235}
serializedVersion: 2
m_Mass: 1
m_Drag: 0
m_AngularDrag: 0.05
m_UseGravity: 0
m_IsKinematic: 0
m_Interpolate: 0
m_Constraints: 0
m_CollisionDetection: 0
--- !u!114 &-8135213758794226317
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 110186699040962235}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 27d5aece569884644adbb9c08a9cbcea, type: 3}
m_Name:
m_EditorClassIdentifier:
color: {r: 0, g: 0, b: 0, a: 0}

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: a13607a17a1a61a4495abe21eb93f29e
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

8
Assets/ZuMa/Scenes.meta Normal file
View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 994d1301aa90f4048bf9be14ba9981d7
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 89f38d4b0d9f86d4aaff5914fab84dbe
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

8
Assets/ZuMa/Scripts.meta Normal file
View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: fc405cc3d6355a3479203da90b68dc21
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,38 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class QiuObject : MonoBehaviour
{
public Color[] colors = new Color[]
{
Color.red,
Color.green,
Color.blue,
Color.yellow,
Color.cyan,
Color.magenta
};
public Color color;
void Awake()
{
color = colors[Mathf.FloorToInt(Random.Range(0, colors.Length))];
var render = GetComponent<Renderer>();
render.material.color = color;
}
// Start is called before the first frame update
void Start()
{
}
//// Update is called once per frame
//void Update()
//{
//}
}

View File

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

View File

@ -0,0 +1,89 @@
using System.Collections;
using System.Collections.Generic;
using Unity.VisualScripting;
using UnityEngine;
public class RingManager : MonoBehaviour
{
public int initCount = 12;
public float radius = 3f;
public Transform qiu;
// 旋转力大小可在Inspector面板调整
//public float rotationalForce = 5f;
private List<Transform> qiuList = new List<Transform>();
public float rotationalSpeed = 5f; // 改为角速度(弧度/秒),更直观
void Start()
{
var qiuCollider = qiu.GetComponent<SphereCollider>();
float ringLen = 2 * Mathf.PI * radius;
float len = Mathf.FloorToInt(ringLen / (qiuCollider.radius * qiu.localScale.x) / 2);
for (int i = 0; i < initCount; i++)
{
float angle = 360 - (i / len) * Mathf.PI * 2; // 修正角度计算逻辑
Vector3 pos = new Vector3(Mathf.Cos(angle), 0, Mathf.Sin(angle)) * radius;
var qiuInst = Instantiate(qiu, pos, Quaternion.identity);
qiuInst.SetParent(transform, true);
// 确保小球有刚体组件并配置参数
Rigidbody rb = qiuInst.GetComponent<Rigidbody>();
if (rb == null)
rb = qiuInst.AddComponent<Rigidbody>();
// 配置刚体属性(避免重力影响,冻结不必要的运动)
rb.useGravity = false;
rb.constraints = RigidbodyConstraints.FreezePositionY | RigidbodyConstraints.FreezeRotation;
qiuList.Add(qiuInst);
}
// 初始施加旋转力
//ApplyRotationalForce();
}
// 给所有小球施加旋转力的方法
//void ApplyRotationalForce()
//{
// foreach (var ball in qiuList)
// {
// Rigidbody rb = ball.GetComponent<Rigidbody>();
// if (rb == null) continue;
// // 1. 计算小球相对于中心的径向向量(从中心指向小球)
// Vector3 radialDirection = (ball.position - transform.position).normalized;
// // 2. 计算切线方向垂直于径向绕Y轴旋转的方向
// // Vector3.Cross(radialDirection, Vector3.up) = 逆时针旋转方向
// // Vector3.Cross(Vector3.up, radialDirection) = 顺时针旋转方向
// Vector3 tangentialDirection = Vector3.Cross(radialDirection, -Vector3.up).normalized;
// // 3. 施加切线方向的力(使小球绕中心旋转)
// //rb.AddForce(tangentialDirection * rotationalForce);
// // 可选:如果想保持恒定速度,可直接设置角速度而非持续加力
// float angularSpeed = rotationalForce / radius;
// rb.velocity = tangentialDirection * angularSpeed * radius;
// }
//}
// 可选在FixedUpdate中持续施加力会让小球加速旋转
void FixedUpdate()
{
// 或逐个旋转小球(如果需要独立控制)
foreach (var ball in qiuList)
{
ball.RotateAround(transform.position, Vector3.up, rotationalSpeed * Time.deltaTime * Mathf.Rad2Deg);
}
}
private void OnDestroy()
{
foreach (var ball in qiuList)
{
Destroy(ball.gameObject);
}
}
}

View File

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