Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using MEC;
- using UnityEngine;
- using UnityEngine.Networking;
- using UnityStandardAssets.Characters.FirstPerson;
- // Token: 0x02000211 RID: 529
- public class Recoil : MonoBehaviour
- {
- // Token: 0x06000EEC RID: 3820 RVA: 0x00055DAC File Offset: 0x00053FAC
- public void DoRecoil(RecoilProperties r, float multip)
- {
- if (this.mlook != null)
- {
- this.backSpeed = r.backSpeed;
- this.lerpSpeed = r.lerpSpeed;
- this.recoil += r.shockSize * multip;
- this.target = new Vector3
- {
- x = (float)UnityEngine.Random.Range(-70, -50),
- y = (float)UnityEngine.Random.Range(-20, 20),
- z = (float)UnityEngine.Random.Range(-20, 20)
- };
- Vector3 vector = multip * this.target.normalized * 13f * r.upSize;
- this.mlook.Recoil(0f - vector.x, vector.y);
- }
- }
- // Token: 0x06000EED RID: 3821 RVA: 0x00055E77 File Offset: 0x00054077
- private void Start()
- {
- Timing.RunCoroutine(this._Start(), Segment.FixedUpdate);
- }
- // Token: 0x06000EEE RID: 3822 RVA: 0x00055E86 File Offset: 0x00054086
- private IEnumerator<float> _Start()
- {
- if (!base.GetComponentInParent<NetworkIdentity>().isLocalPlayer)
- {
- yield break;
- }
- Recoil.singleton = this;
- yield return 0f;
- this.mlook = base.GetComponentInParent<FirstPersonController>().m_MouseLook;
- while (this != null)
- {
- this.recoil -= this.backSpeed / 50f;
- this.recoil = Mathf.Clamp01(this.recoil);
- Vector3 euler = Vector3.Lerp(Vector3.zero, this.target, this.recoil);
- base.transform.localRotation = Quaternion.Lerp(base.transform.localRotation, Quaternion.Euler(euler), (this.lerpSpeed * this.recoil + 1f) / 10f);
- base.transform.localPosition = Vector3.up * (this.positionOffset + 0.8380203f);
- yield return 0f;
- }
- yield break;
- }
- // Token: 0x06000EEF RID: 3823 RVA: 0x00055E95 File Offset: 0x00054095
- public static void StaticDoRecoil(RecoilProperties r, float multip)
- {
- Recoil.singleton.DoRecoil(r, multip);
- }
- // Token: 0x04000F4C RID: 3916
- public static Recoil singleton;
- // Token: 0x04000F4D RID: 3917
- public GameObject plyCam;
- // Token: 0x04000F4E RID: 3918
- private float recoil;
- // Token: 0x04000F4F RID: 3919
- private float backSpeed = 1f;
- // Token: 0x04000F50 RID: 3920
- private float lerpSpeed = 1f;
- // Token: 0x04000F51 RID: 3921
- private Vector3 target;
- // Token: 0x04000F52 RID: 3922
- private MouseLook mlook;
- // Token: 0x04000F53 RID: 3923
- public float positionOffset;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement