powerfun-unity/Assets/AR/AbstractRenderer.cs
2023-04-18 17:10:48 +08:00

59 lines
1.4 KiB
C#

using System.Runtime.InteropServices;
using UnityEngine;
namespace Assets.AR
{
public abstract class AbstractRenderer : ARLaneGameObject
{
protected Animator animator;
protected MaterialPropertyBlock materialPropertyBlock;
private bool paused = true;
public bool Male { get; protected set; }
public bool Paused
{
get => this.paused;
set
{
if (value == this.paused)
return;
this.paused = value;
this.OnPause(this.paused);
}
}
protected override void Awake()
{
base.Awake();
this.animator = this.GetComponent<Animator>();
this.materialPropertyBlock = new MaterialPropertyBlock();
}
public void Initialize(bool male) => this.Male = male;
protected virtual void Start()
{
this.animator.avatar = null;
}
protected override void Update()
{
base.Update();
}
protected virtual void OnPause(bool paused)
{
}
protected void SetLayerRecursively(GameObject obj, int layer)
{
obj.layer = layer;
foreach (Component component in obj.transform)
this.SetLayerRecursively(component.gameObject, layer);
}
}
}