3D交互点跳步自动删除

This commit is contained in:
shenjianxing 2025-01-21 11:47:12 +08:00
parent 6c5aa4b7be
commit 677825a26e

View File

@ -4,6 +4,7 @@ using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using XMLTool; using XMLTool;
using static OperationController;
public class Point3DItem : MonoBehaviour public class Point3DItem : MonoBehaviour
{ {
@ -37,11 +38,18 @@ public class Point3DItem : MonoBehaviour
rotSpeed = data.rotateSpeed; rotSpeed = data.rotateSpeed;
gameObject.GetComponent<SpriteRenderer>().sortingOrder = data.order; gameObject.GetComponent<SpriteRenderer>().sortingOrder = data.order;
TypeEventSystem.Global.Register<OnPoint3DQuestionDestroy>(OnObjDestroy).UnRegisterWhenGameObjectDestroyed(gameObject); TypeEventSystem.Global.Register<OnPoint3DQuestionDestroy>(OnObjDestroy).UnRegisterWhenGameObjectDestroyed(gameObject);
TypeEventSystem.Global.Register<StepStatusOnChange>(OnStepChanged);
} }
private void OnStepChanged(StepStatusOnChange change)
{
OnObjDestroy(default);
}
private void OnObjDestroy(OnPoint3DQuestionDestroy destroy) private void OnObjDestroy(OnPoint3DQuestionDestroy destroy)
{ {
TypeEventSystem.Global.UnRegister<StepStatusOnChange>(OnStepChanged);
GameObject.Destroy(gameObject); GameObject.Destroy(gameObject);
} }