66 lines
1.6 KiB
C#
66 lines
1.6 KiB
C#
using System;
|
|
using UnityEngine;
|
|
|
|
// Token: 0x0200003C RID: 60
|
|
public class MechanimSounds : StateMachineBehaviour
|
|
{
|
|
// Token: 0x060007FD RID: 2045 RVA: 0x000AFBD7 File Offset: 0x000ADDD7
|
|
public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
|
|
{
|
|
this.lastRepetition = 0;
|
|
if (!this.body)
|
|
{
|
|
this.body = animator.gameObject.GetComponent<Body>();
|
|
}
|
|
}
|
|
|
|
// Token: 0x060007FE RID: 2046 RVA: 0x000AFC00 File Offset: 0x000ADE00
|
|
public override void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
|
|
{
|
|
int num = (int)stateInfo.normalizedTime;
|
|
float num2 = stateInfo.normalizedTime - (float)num;
|
|
if (this.lastRepetition >= 0 && num > this.lastRepetition)
|
|
{
|
|
this.fireTimedEvent1 = true;
|
|
this.fireTimedEvent2 = true;
|
|
}
|
|
if (num2 > this.whenToFireEvent1 && this.fireTimedEvent1)
|
|
{
|
|
this.fireTimedEvent1 = false;
|
|
if (this.soundToPlay == "Footsteps")
|
|
{
|
|
this.body.Footstep1();
|
|
}
|
|
}
|
|
if (num2 > this.whenToFireEvent2 && this.fireTimedEvent2)
|
|
{
|
|
this.fireTimedEvent2 = false;
|
|
if (this.soundToPlay == "Footsteps")
|
|
{
|
|
this.body.Footstep2();
|
|
}
|
|
}
|
|
}
|
|
|
|
// Token: 0x04000C6A RID: 3178
|
|
public float whenToFireEvent1;
|
|
|
|
// Token: 0x04000C6B RID: 3179
|
|
public float whenToFireEvent2;
|
|
|
|
// Token: 0x04000C6C RID: 3180
|
|
public string soundToPlay;
|
|
|
|
// Token: 0x04000C6D RID: 3181
|
|
private int lastRepetition = -1;
|
|
|
|
// Token: 0x04000C6E RID: 3182
|
|
private bool fireTimedEvent1 = true;
|
|
|
|
// Token: 0x04000C6F RID: 3183
|
|
private bool fireTimedEvent2 = true;
|
|
|
|
// Token: 0x04000C70 RID: 3184
|
|
public Body body;
|
|
}
|