报错修改
This commit is contained in:
@@ -0,0 +1,80 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using Main;
|
||||
using Stary.Evo;
|
||||
using Stary.Evo.AudioCore;
|
||||
using UnityEngine;
|
||||
using YooAsset;
|
||||
|
||||
namespace Main
|
||||
{
|
||||
public class PointController : MonoBehaviour, IController
|
||||
{
|
||||
public ZoneController ZoneController;
|
||||
private SphereCollider sphereCollider;
|
||||
private TextMesh textMesh;
|
||||
private IUnRegister _onTriggerEnterUnRegister;
|
||||
private IUnRegister _onTriggerExitUnRegister;
|
||||
|
||||
public void Init(ZoneController ZoneController, PointData pointData)
|
||||
{
|
||||
this.ZoneController = ZoneController;
|
||||
textMesh = this.transform.GetComponentInChildren<TextMesh>();
|
||||
textMesh.text = pointData.desc;
|
||||
name = pointData.name;
|
||||
//根据数据设置zone 碰撞盒
|
||||
transform.localPosition = pointData.position;
|
||||
transform.localRotation = Quaternion.Euler(pointData.rotation);
|
||||
transform.localScale = pointData.scale;
|
||||
sphereCollider = this.transform.GetOrAddComponent<SphereCollider>();
|
||||
|
||||
_onTriggerEnterUnRegister = sphereCollider.OnTriggerEnterEvent(OnPointTriggerEnterEvent);
|
||||
this.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
public async void OnPointTriggerEnterEvent(Collider collider)
|
||||
{
|
||||
if (collider.gameObject.CompareTag("MainCamera"))
|
||||
{
|
||||
ZoneController.OpenPoint(this);
|
||||
var package=YooAssets.TryGetPackage("Main");
|
||||
var handle=package.LoadAssetAsync<AudioClip>(R.Res.Main.audios.au_effect_element_pop_mp3);
|
||||
await handle.WithCancellation(this.GetCancellationTokenOnDestroy());
|
||||
AudioCoreManager.PlaySFX(new AudioData()
|
||||
{
|
||||
clip = handle.GetAssetObject<AudioClip>()
|
||||
});
|
||||
|
||||
HybridClREntrance entrance= FindObjectOfType<HybridClREntrance>();
|
||||
if (entrance != null)
|
||||
{
|
||||
entrance.OpenDomain(this.name,OpenDomainType.DEFAULT);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError("UnityEvo:HybridClREntrance is null");
|
||||
}
|
||||
ZoneController.BoundingEvent(false);
|
||||
Debug.Log($"【{name}】OnPointTriggerEnterEvent");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public IArchitecture GetArchitecture()
|
||||
{
|
||||
return MainArchitecture.Interface;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public class PointColliderEntity
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public bool IsTrigger { get; set; }
|
||||
public SphereCollider PointCollider { get; set; }
|
||||
|
||||
public Func<Collider> EntorComplete { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user