59 lines
1.3 KiB
C#
59 lines
1.3 KiB
C#
using System;
|
|
using UnityEngine;
|
|
|
|
// Token: 0x0200004A RID: 74
|
|
public class RandomAnimationStart : MonoBehaviour
|
|
{
|
|
// Token: 0x060008C8 RID: 2248 RVA: 0x000BEBE0 File Offset: 0x000BCDE0
|
|
private void Awake()
|
|
{
|
|
if (!this.anim)
|
|
{
|
|
this.anim = base.gameObject.GetComponent<Animator>();
|
|
}
|
|
if (this.anim)
|
|
{
|
|
if (this.anim && base.gameObject.activeSelf)
|
|
{
|
|
this.anim.Play(this.anim.GetCurrentAnimatorStateInfo(0).shortNameHash, 0, Random.Range(0f, 1f));
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (!this.r)
|
|
{
|
|
this.r = base.gameObject.GetComponent<MeshRenderer>();
|
|
}
|
|
if (this.r)
|
|
{
|
|
foreach (Material material in this.r.materials)
|
|
{
|
|
if (material.HasProperty("offsetFrameNum"))
|
|
{
|
|
int num = (int)material.GetFloat("_TotalFrames");
|
|
int num2 = Random.Range(0, num - 1);
|
|
material.SetInt("offsetFrameNum", num2);
|
|
Debug.Log(num2);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
base.enabled = false;
|
|
}
|
|
|
|
// Token: 0x060008C9 RID: 2249 RVA: 0x000BECFC File Offset: 0x000BCEFC
|
|
public void Restart()
|
|
{
|
|
if (this.anim && base.gameObject.activeSelf)
|
|
{
|
|
this.anim.Play(this.anim.GetCurrentAnimatorStateInfo(0).shortNameHash, 0, Random.Range(0f, 1f));
|
|
}
|
|
}
|
|
|
|
// Token: 0x04000DE8 RID: 3560
|
|
private Animator anim;
|
|
|
|
// Token: 0x04000DE9 RID: 3561
|
|
private MeshRenderer r;
|
|
}
|