using System;
using UnityEngine;

namespace cakeslice
{
	// Token: 0x02000116 RID: 278
	[RequireComponent(typeof(Renderer))]
	public class OutlineGlow : MonoBehaviour
	{
		// Token: 0x17000060 RID: 96
		// (get) Token: 0x060016A4 RID: 5796 RVA: 0x001A038B File Offset: 0x0019E58B
		// (set) Token: 0x060016A5 RID: 5797 RVA: 0x001A0393 File Offset: 0x0019E593
		public Renderer Renderer { get; private set; }

		// Token: 0x17000061 RID: 97
		// (get) Token: 0x060016A6 RID: 5798 RVA: 0x001A039C File Offset: 0x0019E59C
		// (set) Token: 0x060016A7 RID: 5799 RVA: 0x001A03A4 File Offset: 0x0019E5A4
		public SkinnedMeshRenderer SkinnedMeshRenderer { get; private set; }

		// Token: 0x17000062 RID: 98
		// (get) Token: 0x060016A8 RID: 5800 RVA: 0x001A03AD File Offset: 0x0019E5AD
		// (set) Token: 0x060016A9 RID: 5801 RVA: 0x001A03B5 File Offset: 0x0019E5B5
		public MeshFilter MeshFilter { get; private set; }

		// Token: 0x060016AA RID: 5802 RVA: 0x001A03BE File Offset: 0x0019E5BE
		private void Awake()
		{
			this.Renderer = base.GetComponent<Renderer>();
			this.SkinnedMeshRenderer = base.GetComponent<SkinnedMeshRenderer>();
			this.MeshFilter = base.GetComponent<MeshFilter>();
		}

		// Token: 0x060016AB RID: 5803 RVA: 0x001A03E4 File Offset: 0x0019E5E4
		private void OnEnable()
		{
			OutlineEffectGlow instance = OutlineEffectGlow.Instance;
			if (instance != null)
			{
				instance.AddOutline(this);
			}
			this.added = true;
		}

		// Token: 0x060016AC RID: 5804 RVA: 0x001A03FE File Offset: 0x0019E5FE
		private void OnDisable()
		{
			OutlineEffectGlow instance = OutlineEffectGlow.Instance;
			if (instance != null)
			{
				instance.RemoveOutline(this);
			}
			this.added = false;
		}

		// Token: 0x060016AD RID: 5805 RVA: 0x001A0418 File Offset: 0x0019E618
		private void Update()
		{
			if (this.Renderer)
			{
				if (this.Renderer.enabled && !this.added)
				{
					OutlineEffectGlow instance = OutlineEffectGlow.Instance;
					if (instance != null)
					{
						instance.AddOutline(this);
					}
					this.added = true;
				}
				if (!this.Renderer.enabled && this.added)
				{
					OutlineEffectGlow instance2 = OutlineEffectGlow.Instance;
					if (instance2 != null)
					{
						instance2.RemoveOutline(this);
					}
					this.added = false;
				}
			}
			if (this.SkinnedMeshRenderer)
			{
				if (this.SkinnedMeshRenderer.enabled && !this.added)
				{
					OutlineEffectGlow instance3 = OutlineEffectGlow.Instance;
					if (instance3 != null)
					{
						instance3.AddOutline(this);
					}
					this.added = true;
				}
				if (!this.SkinnedMeshRenderer.enabled && this.added)
				{
					OutlineEffectGlow instance4 = OutlineEffectGlow.Instance;
					if (instance4 != null)
					{
						instance4.RemoveOutline(this);
					}
					this.added = false;
				}
			}
			if (!base.gameObject.activeInHierarchy)
			{
				if (this.added)
				{
					OutlineEffectGlow instance5 = OutlineEffectGlow.Instance;
					if (instance5 != null)
					{
						instance5.RemoveOutline(this);
					}
				}
				Object.Destroy(this);
			}
			if (this.character && (this.character.dazedCount == 0 || this.character.dead || this.character.stunned))
			{
				if (this.added)
				{
					OutlineEffectGlow instance6 = OutlineEffectGlow.Instance;
					if (instance6 != null)
					{
						instance6.RemoveOutline(this);
					}
				}
				Object.Destroy(this);
			}
		}

		// Token: 0x17000063 RID: 99
		// (get) Token: 0x060016AE RID: 5806 RVA: 0x001A0572 File Offset: 0x0019E772
		public Material[] SharedMaterials
		{
			get
			{
				if (this._SharedMaterials == null)
				{
					this._SharedMaterials = this.Renderer.sharedMaterials;
				}
				return this._SharedMaterials;
			}
		}

		// Token: 0x040026C9 RID: 9929
		public int color;

		// Token: 0x040026CA RID: 9930
		public bool eraseRenderer;

		// Token: 0x040026CB RID: 9931
		public bool added;

		// Token: 0x040026CC RID: 9932
		public Character character;

		// Token: 0x040026CD RID: 9933
		private Material[] _SharedMaterials;
	}
}
