79 lines
1.5 KiB
C#
79 lines
1.5 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using Sirenix.OdinInspector;
|
|
using UnityEngine.Serialization;
|
|
|
|
public enum ESceneObjectType
|
|
{
|
|
None = 0,
|
|
Tree = 1, //树
|
|
Buildings = 2,//建筑物
|
|
}
|
|
|
|
/// <summary>
|
|
/// 场景中对象,可以方便地执行一些渲染上的效果,如半透,面片渲染等
|
|
/// </summary>
|
|
public class SceneObject : MonoBehaviour
|
|
{
|
|
#region Fields
|
|
|
|
[SerializeField]
|
|
[LabelText("是否半透")]
|
|
[OnValueChanged("Refresh")]
|
|
private bool _transparent;
|
|
|
|
[SerializeField]
|
|
[LabelText("是否使用面片")]
|
|
[OnValueChanged("Refresh")]
|
|
private bool _useSurface;
|
|
|
|
[ReadOnly]
|
|
//[HideInInspector]
|
|
[SerializeField]
|
|
public SceneObjectRenderInfo renderInfo;
|
|
|
|
[ReadOnly]
|
|
[LabelText("对象类型")]
|
|
[SerializeField]
|
|
public ESceneObjectType sceneObjectType;
|
|
|
|
#endregion
|
|
|
|
#region API
|
|
|
|
public ESceneObjectType Type => sceneObjectType;
|
|
|
|
public bool Transparent
|
|
{
|
|
get => _transparent;
|
|
set
|
|
{
|
|
if (_transparent != value)
|
|
{
|
|
_transparent = value;
|
|
Refresh();
|
|
}
|
|
}
|
|
}
|
|
|
|
public bool UseSurface
|
|
{
|
|
get => _useSurface;
|
|
set
|
|
{
|
|
if (_useSurface != value)
|
|
{
|
|
_useSurface = value;
|
|
Refresh();
|
|
}
|
|
}
|
|
}
|
|
|
|
private void Refresh()
|
|
{
|
|
}
|
|
|
|
#endregion
|
|
} |