74 lines
2.0 KiB
C#
74 lines
2.0 KiB
C#
using System;
|
|
using UnityEngine;
|
|
|
|
// Token: 0x02000017 RID: 23
|
|
[Serializable]
|
|
public class crouchandrun : MonoBehaviour
|
|
{
|
|
// Token: 0x06000057 RID: 87 RVA: 0x00004308 File Offset: 0x00002508
|
|
public crouchandrun()
|
|
{
|
|
this.walkSpeed = (float)7;
|
|
this.crchSpeed = (float)3;
|
|
this.runSpeed = (float)20;
|
|
}
|
|
|
|
// Token: 0x06000058 RID: 88 RVA: 0x0000432C File Offset: 0x0000252C
|
|
public virtual void Start()
|
|
{
|
|
this.chMotor = (CharacterMotor)this.GetComponent(typeof(CharacterMotor));
|
|
this.tr = this.transform;
|
|
CharacterController characterController = (CharacterController)this.GetComponent(typeof(CharacterController));
|
|
this.dist = characterController.height / (float)2;
|
|
}
|
|
|
|
// Token: 0x06000059 RID: 89 RVA: 0x00004388 File Offset: 0x00002588
|
|
public virtual void Update()
|
|
{
|
|
float num = 1f;
|
|
float num2 = this.walkSpeed;
|
|
if ((this.chMotor.grounded && Input.GetKey("left shift")) || Input.GetKey("right shift"))
|
|
{
|
|
num2 = this.runSpeed;
|
|
}
|
|
if (Input.GetKey("c"))
|
|
{
|
|
num = 0.5f;
|
|
num2 = this.crchSpeed;
|
|
}
|
|
this.chMotor.movement.maxForwardSpeed = num2;
|
|
float y = this.tr.localScale.y;
|
|
float num3 = Mathf.Lerp(this.tr.localScale.y, num, (float)5 * Time.deltaTime);
|
|
Vector3 localScale = this.tr.localScale;
|
|
float num4 = (localScale.y = num3);
|
|
Vector3 vector = (this.tr.localScale = localScale);
|
|
float num5 = this.tr.position.y + this.dist * (this.tr.localScale.y - y);
|
|
Vector3 position = this.tr.position;
|
|
float num6 = (position.y = num5);
|
|
Vector3 vector2 = (this.tr.position = position);
|
|
}
|
|
|
|
// Token: 0x0600005A RID: 90 RVA: 0x000044D8 File Offset: 0x000026D8
|
|
public virtual void Main()
|
|
{
|
|
}
|
|
|
|
// Token: 0x0400007F RID: 127
|
|
public float walkSpeed;
|
|
|
|
// Token: 0x04000080 RID: 128
|
|
public float crchSpeed;
|
|
|
|
// Token: 0x04000081 RID: 129
|
|
public float runSpeed;
|
|
|
|
// Token: 0x04000082 RID: 130
|
|
private CharacterMotor chMotor;
|
|
|
|
// Token: 0x04000083 RID: 131
|
|
private Transform tr;
|
|
|
|
// Token: 0x04000084 RID: 132
|
|
private float dist;
|
|
}
|