123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128 |
- using SC.XR.Unity.Module_InputSystem;
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class BaseTemPlate : MonoBehaviour
- {
- private Transform m_Transform;
- private GameObject m_Go;
- private MaterialType m_SuCaiType;
- private MaterialObjValue m_SuCaiData;
- private DownloadData m_Data;
- private bool m_IsSetData = true;
- private bool state = false;
- public Transform CacheTransform
- {
- get
- {
- if (m_Transform == null)
- {
- m_Transform = transform;
- }
- return m_Transform;
- }
- }
- public GameObject CacheGameObject
- {
- get
- {
- if (this.m_Go == null)
- {
- this.m_Go = base.gameObject;
- }
- return this.m_Go;
- }
- }
- public MaterialType SuCaiType
- {
- get { return m_SuCaiType; }
- set { m_SuCaiType = value; }
- }
- public MaterialObjValue SuCaiData
- {
- get { return m_SuCaiData; }
- set { m_SuCaiData = value; }
- }
- public DownloadData Data
- {
- get { return m_Data; }
- set { m_Data = value; }
- }
- /// <summary>
- /// 是否为设置数据
- /// </summary>
- public bool IsSetData
- {
- get { return m_IsSetData; }
- set { m_IsSetData = value; }
- }
- private void Awake()
- {
- OnAwake();
- }
- public void Init()
- {
- OnInit();
- }
- private void Update()
- {
- if(state)
- {
- HideCollider();
- }
- // HideCollider();
- }
- protected virtual void OnEnable()
- {
- }
- /// <summary>
- /// 用户端执行代码
- /// 隐藏碰撞器及移动缩放功能,在用户端只观看不进行任何操作
- /// </summary>
- public virtual void HideCollider()
- {
- state = true;
- if (GetComponent<BoxCollider>() != null)
- GetComponent<BoxCollider>().enabled = GameManager.Instance.IsStartEditor;
- if (GetComponent<BoundingBox>() != null)
- GetComponent<BoundingBox>().enabled = GameManager.Instance.IsStartEditor;
- if (GetComponent<ManipulationHandler>() != null)
- GetComponent<ManipulationHandler>().enabled = GameManager.Instance.IsStartEditor;
- if (transform.Find("BoundingBox") != null)
- transform.Find("BoundingBox").gameObject.SetActive(GameManager.Instance.IsStartEditor);
- }
- /// <summary>
- /// 设置素材属性
- /// </summary>
- /// <param name="value">当前素材数据</param>
- public virtual void SetData(MaterialObjValue value, int updateTime)
- {
- m_SuCaiData = value;
- // Debug.Log("@@@@@ " );
- Data = new DownloadData(value);
- // Debug.Log("@@@@@ " + Data.localSavePath);
- Data.updateTime = updateTime;
- IsSetData = false;
- }
- protected virtual void OnAwake()
- {
- Data = null;
- }
- protected virtual void OnInit()
- {
- }
- }
|