68 lines
1.3 KiB
C#
68 lines
1.3 KiB
C#
using System;
|
|
using UnityEngine;
|
|
|
|
// Token: 0x0200004E RID: 78
|
|
public class SetSpellMaterial : MonoBehaviour
|
|
{
|
|
// Token: 0x06000908 RID: 2312 RVA: 0x000C22E7 File Offset: 0x000C04E7
|
|
private void OnEnable()
|
|
{
|
|
this.Set(1f, 1f);
|
|
}
|
|
|
|
// Token: 0x06000909 RID: 2313 RVA: 0x000C22FC File Offset: 0x000C04FC
|
|
public void Set(float curr, float max)
|
|
{
|
|
if (this.type == "Cocoon")
|
|
{
|
|
if (this.meshrenderers == null)
|
|
{
|
|
this.meshrenderers = base.gameObject.GetComponentsInChildren<MeshRenderer>(true);
|
|
this.mats = Links.x.cellar.cocoonMaterials;
|
|
}
|
|
Debug.Log(curr.ToString() + " " + max.ToString());
|
|
if (max < curr)
|
|
{
|
|
max = curr;
|
|
}
|
|
float num = curr / max;
|
|
int num2 = 0;
|
|
if (num >= 1f)
|
|
{
|
|
num2 = 0;
|
|
}
|
|
if (num < 1f && num >= 0.75f)
|
|
{
|
|
num2 = 1;
|
|
}
|
|
if (num < 0.75f && num >= 0.5f)
|
|
{
|
|
num2 = 2;
|
|
}
|
|
if (num < 0.5f && num >= 0.25f)
|
|
{
|
|
num2 = 3;
|
|
}
|
|
if (num < 0.25f)
|
|
{
|
|
num2 = 4;
|
|
}
|
|
Debug.Log(num2);
|
|
MeshRenderer[] array = this.meshrenderers;
|
|
for (int i = 0; i < array.Length; i++)
|
|
{
|
|
array[i].sharedMaterial = this.mats[num2];
|
|
}
|
|
}
|
|
}
|
|
|
|
// Token: 0x04000E25 RID: 3621
|
|
public string type;
|
|
|
|
// Token: 0x04000E26 RID: 3622
|
|
private MeshRenderer[] meshrenderers;
|
|
|
|
// Token: 0x04000E27 RID: 3623
|
|
private Material[] mats;
|
|
}
|