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; }
}
///
/// 是否为设置数据
///
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()
{
}
///
/// 用户端执行代码
/// 隐藏碰撞器及移动缩放功能,在用户端只观看不进行任何操作
///
public virtual void HideCollider()
{
state = true;
if (GetComponent() != null)
GetComponent().enabled = GameManager.Instance.IsStartEditor;
if (GetComponent() != null)
GetComponent().enabled = GameManager.Instance.IsStartEditor;
if (GetComponent() != null)
GetComponent().enabled = GameManager.Instance.IsStartEditor;
if (transform.Find("BoundingBox") != null)
transform.Find("BoundingBox").gameObject.SetActive(GameManager.Instance.IsStartEditor);
}
///
/// 设置素材属性
///
/// 当前素材数据
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()
{
}
}