123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- using UnityEngine;
- using Blue;
- public class LoadReference : AbstractController
- {
- public GameObject goRefrence;
- private Transform meshTest=>(SceneIOCContainer.Instance.Pull("mesh_test")as GameObject).transform;
- private Transform meshTestParent=>(SceneIOCContainer.Instance.Pull("ARSpaceForAll")as GameObject).transform;
- private bool bool_GetReferencePosEvent=false;
- private bool bool_InitEvent=false;
- private Vector3 pos;
- private void Start()
- {
- this.RegisterEvent<GetReferencePosEvent>(GetObjOfRefrencePosRotSuccess).UnRegisterWhenGameObjectDestroyed(gameObject);
- this.RegisterEvent<InitEvent>(InitEventSuccess).UnRegisterWhenGameObjectDestroyed(gameObject);
- }
- private void GetObjOfRefrencePosRotSuccess(GetReferencePosEvent e)
- {
- bool_GetReferencePosEvent = true;
- pos = new Vector3(e.PosRot.x, e.PosRot.y, e.PosRot.z);
- if(bool_GetReferencePosEvent && bool_InitEvent)
- {
- SetPosRot(pos);
- }
- }
- private void InitEventSuccess(InitEvent e)
- {
- bool_InitEvent = true;
- if(bool_GetReferencePosEvent && bool_InitEvent)
- {
- SetPosRot(pos);
- }
- }
- private void SetPosRot(Vector3 pos)
- {
- goRefrence = Instantiate(goRefrence,meshTest);
- goRefrence.name = "goRefrence";
- SceneIOCContainer.Instance.Push("goRefrence",goRefrence);
- goRefrence.transform.localPosition = pos;
- goRefrence.transform.parent = meshTestParent;
- SetSceneActive.Instance.goReference_y = goRefrence.transform.position.y;
- goRefrence.SetActive(false);
- }
- }
|