summaryrefslogtreecommitdiff
path: root/_ActiveRagdoll
diff options
context:
space:
mode:
Diffstat (limited to '_ActiveRagdoll')
-rw-r--r--_ActiveRagdoll/AnimationHandler.cs14
-rw-r--r--_ActiveRagdoll/Balance.cs101
-rw-r--r--_ActiveRagdoll/BodyParts/ArmLeft.cs12
-rw-r--r--_ActiveRagdoll/BodyParts/ArmRight.cs12
-rw-r--r--_ActiveRagdoll/BodyParts/FootLeft.cs12
-rw-r--r--_ActiveRagdoll/BodyParts/FootRight.cs12
-rw-r--r--_ActiveRagdoll/BodyParts/KneeLeft.cs12
-rw-r--r--_ActiveRagdoll/BodyParts/KneeRight.cs12
-rw-r--r--_ActiveRagdoll/BodyParts/LegLeft.cs12
-rw-r--r--_ActiveRagdoll/BodyParts/LegRight.cs12
-rw-r--r--_ActiveRagdoll/BodyParts/Neck.cs12
-rw-r--r--_ActiveRagdoll/BodyParts/Torso.cs12
-rw-r--r--_ActiveRagdoll/Damagable.cs54
-rw-r--r--_ActiveRagdoll/DamageEffects.cs84
-rw-r--r--_ActiveRagdoll/DragHandler.cs25
-rw-r--r--_ActiveRagdoll/FootHandler.cs75
-rw-r--r--_ActiveRagdoll/Gravity.cs47
-rw-r--r--_ActiveRagdoll/HandLeft.cs12
-rw-r--r--_ActiveRagdoll/HandRight.cs12
-rw-r--r--_ActiveRagdoll/HasControl.cs28
-rw-r--r--_ActiveRagdoll/Head.cs12
-rw-r--r--_ActiveRagdoll/HeadCollisionHandler.cs31
-rw-r--r--_ActiveRagdoll/Hip.cs12
-rw-r--r--_ActiveRagdoll/Holding.cs288
-rw-r--r--_ActiveRagdoll/InputHandler.cs120
-rw-r--r--_ActiveRagdoll/LeftHandPos.cs12
-rw-r--r--_ActiveRagdoll/MovementDataHandler.cs92
-rw-r--r--_ActiveRagdoll/MovementHandler.cs85
-rw-r--r--_ActiveRagdoll/PickupHandler.cs63
-rw-r--r--_ActiveRagdoll/Player.cs18
-rw-r--r--_ActiveRagdoll/PlayerDeath.cs125
-rw-r--r--_ActiveRagdoll/PlayerKnockback.cs52
-rw-r--r--_ActiveRagdoll/RagdollHandler.cs21
-rw-r--r--_ActiveRagdoll/RemoveMouse.cs17
-rw-r--r--_ActiveRagdoll/RigidbodyHolder.cs44
-rw-r--r--_ActiveRagdoll/RotationHandler.cs73
-rw-r--r--_ActiveRagdoll/SetAnimationByInput.cs40
-rw-r--r--_ActiveRagdoll/SetAnimationByVelocity.cs12
-rw-r--r--_ActiveRagdoll/SetRigidbodySettings.cs20
-rw-r--r--_ActiveRagdoll/Standing.cs55
-rw-r--r--_ActiveRagdoll/StandingDataHandler.cs69
-rw-r--r--_ActiveRagdoll/StartRotation.cs18
-rw-r--r--_ActiveRagdoll/StayInPlace.cs50
-rw-r--r--_ActiveRagdoll/StepHandler.cs53
-rw-r--r--_ActiveRagdoll/Strength.cs21
-rw-r--r--_ActiveRagdoll/WeaponHandler.cs75
46 files changed, 2050 insertions, 0 deletions
diff --git a/_ActiveRagdoll/AnimationHandler.cs b/_ActiveRagdoll/AnimationHandler.cs
new file mode 100644
index 0000000..6011e47
--- /dev/null
+++ b/_ActiveRagdoll/AnimationHandler.cs
@@ -0,0 +1,14 @@
+using UnityEngine;
+
+public class AnimationHandler : MonoBehaviour
+{
+ public int animationState;
+
+ private void Start()
+ {
+ }
+
+ private void Update()
+ {
+ }
+}
diff --git a/_ActiveRagdoll/Balance.cs b/_ActiveRagdoll/Balance.cs
new file mode 100644
index 0000000..dc9ae60
--- /dev/null
+++ b/_ActiveRagdoll/Balance.cs
@@ -0,0 +1,101 @@
+using UnityEngine;
+
+public class Balance : MonoBehaviour
+{
+ private Rigidbody handLeft;
+
+ private Rigidbody handRight;
+
+ private Rigidbody footLeft;
+
+ private Rigidbody footRight;
+
+ private Rigidbody hip;
+
+ private Vector3 centerOfMass;
+
+ private Rigidbody[] allRigs;
+
+ public float[] balanceForce;
+
+ public float[] footCenterForces;
+
+ private AnimationHandler animationHandler;
+
+ private PlayerDeath death;
+
+ private Strength str;
+
+ private float muscleMultiplier;
+
+ private void Start()
+ {
+ death = GetComponent<PlayerDeath>();
+ str = GetComponent<Strength>();
+ allRigs = GetComponentsInChildren<Rigidbody>();
+ HandLeft componentInChildren = GetComponentInChildren<HandLeft>();
+ if ((bool)componentInChildren)
+ {
+ handLeft = componentInChildren.GetComponent<Rigidbody>();
+ }
+ HandRight componentInChildren2 = GetComponentInChildren<HandRight>();
+ if ((bool)componentInChildren2)
+ {
+ handRight = componentInChildren2.GetComponent<Rigidbody>();
+ }
+ footLeft = GetComponentInChildren<KneeLeft>().GetComponent<Rigidbody>();
+ footRight = GetComponentInChildren<KneeRight>().GetComponent<Rigidbody>();
+ hip = GetComponentInChildren<Hip>().GetComponent<Rigidbody>();
+ animationHandler = GetComponent<AnimationHandler>();
+ }
+
+ private void FixedUpdate()
+ {
+ if (!death.dead)
+ {
+ muscleMultiplier = str.strength;
+ centerOfMass = Vector3.zero;
+ Rigidbody[] array = allRigs;
+ foreach (Rigidbody rigidbody in array)
+ {
+ centerOfMass += rigidbody.worldCenterOfMass;
+ }
+ centerOfMass /= (float)allRigs.Length;
+ centerOfMass.y = 0f;
+ BalanceLegs();
+ CenterLegs();
+ }
+ }
+
+ private void CenterLegs()
+ {
+ Vector3 vector = footLeft.transform.position + footLeft.transform.forward * 0.5f;
+ Vector3 vector2 = footRight.transform.position + footRight.transform.forward * 0.5f;
+ Vector3 vector3 = vector;
+ if (vector.y + 0.3f < hip.worldCenterOfMass.y)
+ {
+ vector3.y = 0f;
+ footLeft.AddForceAtPosition((centerOfMass - vector3) * muscleMultiplier * footCenterForces[animationHandler.animationState], vector, ForceMode.Acceleration);
+ }
+ Vector3 vector4 = vector2;
+ if (vector4.y + 0.3f < hip.worldCenterOfMass.y)
+ {
+ vector4.y = 0f;
+ footRight.AddForceAtPosition((centerOfMass - vector4) * muscleMultiplier * footCenterForces[animationHandler.animationState], vector2, ForceMode.Acceleration);
+ }
+ }
+
+ private void BalanceLegs()
+ {
+ Vector3 vector = footLeft.transform.position + footLeft.transform.forward * 0.5f;
+ Vector3 vector2 = footRight.transform.position + footRight.transform.forward * 0.5f;
+ Vector3 vector3 = (vector + vector2) / 2f;
+ if (!(vector3.y + 0.3f > hip.worldCenterOfMass.y))
+ {
+ vector3.y = 0f;
+ Vector3 vector4 = centerOfMass - vector3;
+ footLeft.AddForceAtPosition(vector4 * muscleMultiplier * balanceForce[animationHandler.animationState], vector, ForceMode.Acceleration);
+ footRight.AddForceAtPosition(vector4 * muscleMultiplier * balanceForce[animationHandler.animationState], vector2, ForceMode.Acceleration);
+ }
+ }
+}
diff --git a/_ActiveRagdoll/BodyParts/ArmLeft.cs b/_ActiveRagdoll/BodyParts/ArmLeft.cs
new file mode 100644
index 0000000..b7ee14c
--- /dev/null
+++ b/_ActiveRagdoll/BodyParts/ArmLeft.cs
@@ -0,0 +1,12 @@
+using UnityEngine;
+
+public class ArmLeft : MonoBehaviour
+{
+ private void Start()
+ {
+ }
+
+ private void Update()
+ {
+ }
+}
diff --git a/_ActiveRagdoll/BodyParts/ArmRight.cs b/_ActiveRagdoll/BodyParts/ArmRight.cs
new file mode 100644
index 0000000..735d646
--- /dev/null
+++ b/_ActiveRagdoll/BodyParts/ArmRight.cs
@@ -0,0 +1,12 @@
+using UnityEngine;
+
+public class ArmRight : MonoBehaviour
+{
+ private void Start()
+ {
+ }
+
+ private void Update()
+ {
+ }
+}
diff --git a/_ActiveRagdoll/BodyParts/FootLeft.cs b/_ActiveRagdoll/BodyParts/FootLeft.cs
new file mode 100644
index 0000000..da0d11f
--- /dev/null
+++ b/_ActiveRagdoll/BodyParts/FootLeft.cs
@@ -0,0 +1,12 @@
+using UnityEngine;
+
+public class FootLeft : MonoBehaviour
+{
+ private void Start()
+ {
+ }
+
+ private void Update()
+ {
+ }
+}
diff --git a/_ActiveRagdoll/BodyParts/FootRight.cs b/_ActiveRagdoll/BodyParts/FootRight.cs
new file mode 100644
index 0000000..c5014db
--- /dev/null
+++ b/_ActiveRagdoll/BodyParts/FootRight.cs
@@ -0,0 +1,12 @@
+using UnityEngine;
+
+public class FootRight : MonoBehaviour
+{
+ private void Start()
+ {
+ }
+
+ private void Update()
+ {
+ }
+}
diff --git a/_ActiveRagdoll/BodyParts/KneeLeft.cs b/_ActiveRagdoll/BodyParts/KneeLeft.cs
new file mode 100644
index 0000000..da00140
--- /dev/null
+++ b/_ActiveRagdoll/BodyParts/KneeLeft.cs
@@ -0,0 +1,12 @@
+using UnityEngine;
+
+public class KneeLeft : MonoBehaviour
+{
+ private void Start()
+ {
+ }
+
+ private void Update()
+ {
+ }
+}
diff --git a/_ActiveRagdoll/BodyParts/KneeRight.cs b/_ActiveRagdoll/BodyParts/KneeRight.cs
new file mode 100644
index 0000000..302a4ed
--- /dev/null
+++ b/_ActiveRagdoll/BodyParts/KneeRight.cs
@@ -0,0 +1,12 @@
+using UnityEngine;
+
+public class KneeRight : MonoBehaviour
+{
+ private void Start()
+ {
+ }
+
+ private void Update()
+ {
+ }
+}
diff --git a/_ActiveRagdoll/BodyParts/LegLeft.cs b/_ActiveRagdoll/BodyParts/LegLeft.cs
new file mode 100644
index 0000000..23446b9
--- /dev/null
+++ b/_ActiveRagdoll/BodyParts/LegLeft.cs
@@ -0,0 +1,12 @@
+using UnityEngine;
+
+public class LegLeft : MonoBehaviour
+{
+ private void Start()
+ {
+ }
+
+ private void Update()
+ {
+ }
+}
diff --git a/_ActiveRagdoll/BodyParts/LegRight.cs b/_ActiveRagdoll/BodyParts/LegRight.cs
new file mode 100644
index 0000000..a050339
--- /dev/null
+++ b/_ActiveRagdoll/BodyParts/LegRight.cs
@@ -0,0 +1,12 @@
+using UnityEngine;
+
+public class LegRight : MonoBehaviour
+{
+ private void Start()
+ {
+ }
+
+ private void Update()
+ {
+ }
+}
diff --git a/_ActiveRagdoll/BodyParts/Neck.cs b/_ActiveRagdoll/BodyParts/Neck.cs
new file mode 100644
index 0000000..31cd544
--- /dev/null
+++ b/_ActiveRagdoll/BodyParts/Neck.cs
@@ -0,0 +1,12 @@
+using UnityEngine;
+
+public class Neck : MonoBehaviour
+{
+ private void Start()
+ {
+ }
+
+ private void Update()
+ {
+ }
+}
diff --git a/_ActiveRagdoll/BodyParts/Torso.cs b/_ActiveRagdoll/BodyParts/Torso.cs
new file mode 100644
index 0000000..3cf28df
--- /dev/null
+++ b/_ActiveRagdoll/BodyParts/Torso.cs
@@ -0,0 +1,12 @@
+using UnityEngine;
+
+public class Torso : MonoBehaviour
+{
+ private void Start()
+ {
+ }
+
+ private void Update()
+ {
+ }
+}
diff --git a/_ActiveRagdoll/Damagable.cs b/_ActiveRagdoll/Damagable.cs
new file mode 100644
index 0000000..667cd5e
--- /dev/null
+++ b/_ActiveRagdoll/Damagable.cs
@@ -0,0 +1,54 @@
+using UnityEngine;
+using UnityEngine.Events;
+
+public class Damagable : MonoBehaviour
+{
+ public float multiplier = 1f;
+
+ private PlayerDeath playerDeath;
+
+ public UnityEvent outOfLiveEvent;
+
+ public UnityEvent damageEvent;
+
+ public float health = 100f;
+
+ private float currentHealth;
+
+ private bool dead;
+
+ private Rigidbody rig;
+
+ private void Start()
+ {
+ rig = GetComponent<Rigidbody>();
+ currentHealth = health;
+ playerDeath = base.transform.root.GetComponent<PlayerDeath>();
+ }
+
+ private void Update()
+ {
+ }
+
+ public void TakeDamage(Vector3 damage, Vector3 hitPoint)
+ {
+ damage *= multiplier;
+ if ((bool)playerDeath)
+ {
+ playerDeath.TakeDamage(damage, hitPoint, rig);
+ return;
+ }
+ damageEvent.Invoke();
+ currentHealth -= damage.magnitude;
+ if (currentHealth < 0f && !dead)
+ {
+ dead = true;
+ outOfLiveEvent.Invoke();
+ }
+ }
+
+ public void RefillHP()
+ {
+ currentHealth = health;
+ }
+}
diff --git a/_ActiveRagdoll/DamageEffects.cs b/_ActiveRagdoll/DamageEffects.cs
new file mode 100644
index 0000000..305c1d7
--- /dev/null
+++ b/_ActiveRagdoll/DamageEffects.cs
@@ -0,0 +1,84 @@
+using UnityEngine;
+using UnityEngine.PostProcessing;
+
+public class DamageEffects : MonoBehaviour
+{
+ private WobbleShake screenShake;
+
+ private ParticleParent[] particleParents;
+
+ private float counter;
+
+ public AnimationCurve curve;
+
+ public AnimationCurve curve2;
+
+ public PostProcessingProfile post;
+
+ private Camera mainCam;
+
+ public float damageValue;
+
+ private Transform hip;
+
+ private void Start()
+ {
+ screenShake = base.transform.root.GetComponentInChildren<WobbleShake>();
+ particleParents = GetComponentsInChildren<ParticleParent>();
+ mainCam = base.transform.root.GetComponentInChildren<Camera>();
+ hip = base.transform.root.GetComponentInChildren<Transform>().transform;
+ }
+
+ private void Update()
+ {
+ VignetteModel.Settings settings = post.vignette.settings;
+ ChromaticAberrationModel.Settings settings2 = post.chromaticAberration.settings;
+ counter += Time.deltaTime;
+ if (damageValue > 0f)
+ {
+ damageValue -= Time.deltaTime * 0.3f;
+ }
+ if (counter < curve.keys[curve.length - 1].time)
+ {
+ float intensity = curve.Evaluate(counter);
+ settings.intensity = intensity;
+ }
+ settings.intensity = Mathf.Lerp(settings.intensity, 0f, Time.deltaTime * 0.5f);
+ settings.intensity = Mathf.Clamp(settings.intensity, 0f, 9f);
+ post.vignette.settings = settings;
+ if (counter < curve2.keys[curve2.length - 1].time)
+ {
+ float intensity2 = curve2.Evaluate(counter);
+ settings2.intensity = intensity2;
+ }
+ settings2.intensity = Mathf.Lerp(settings2.intensity, 0f, Time.deltaTime * 0.5f);
+ settings2.intensity = Mathf.Clamp(settings2.intensity, 0f, 9f);
+ post.chromaticAberration.settings = settings2;
+ }
+
+ public void TakeDamage(Vector3 damage, Vector3 hitPoint)
+ {
+ counter = 0f;
+ damageValue += damage.magnitude * 0.02f;
+ damageValue = Mathf.Clamp(damageValue, 0f, 0.5f);
+ GetComponentInChildren<Torso>().GetComponent<Rigidbody>().AddForce(damage.normalized * (damage.magnitude * 0.3f + 3f), ForceMode.VelocityChange);
+ screenShake.AddShakeWorld(damage * 0.4f, 0.8f);
+ DirectionalParticles(mainCam.transform.InverseTransformDirection(-damage));
+ }
+
+ private void DirectionalParticles(Vector3 damage)
+ {
+ for (int i = 0; i < particleParents.Length; i++)
+ {
+ Vector3 from = particleParents[i].transform.position - particleParents[i].transform.parent.position;
+ Vector3 to = damage;
+ from.y = 0f;
+ to.y = 0f;
+ if (Vector3.Angle(from, to) < 15f + damage.magnitude * 0.5f)
+ {
+ float multi = 1f - Vector3.Angle(from, to) / damage.magnitude * 0.5f;
+ particleParents[i].Play(damage.magnitude, multi);
+ }
+ }
+ }
+}
diff --git a/_ActiveRagdoll/DragHandler.cs b/_ActiveRagdoll/DragHandler.cs
new file mode 100644
index 0000000..adb8df4
--- /dev/null
+++ b/_ActiveRagdoll/DragHandler.cs
@@ -0,0 +1,25 @@
+using UnityEngine;
+
+public class DragHandler : MonoBehaviour
+{
+ private float drag;
+
+ private float angularDrag;
+
+ private Rigidbody rig;
+
+ public float dragAmount = 1f;
+
+ private void Start()
+ {
+ rig = GetComponent<Rigidbody>();
+ drag = rig.drag;
+ angularDrag = rig.angularDrag;
+ }
+
+ private void Update()
+ {
+ rig.drag = drag * dragAmount;
+ rig.angularDrag = angularDrag * dragAmount;
+ }
+}
diff --git a/_ActiveRagdoll/FootHandler.cs b/_ActiveRagdoll/FootHandler.cs
new file mode 100644
index 0000000..7343e21
--- /dev/null
+++ b/_ActiveRagdoll/FootHandler.cs
@@ -0,0 +1,75 @@
+using UnityEngine;
+
+public class FootHandler : MonoBehaviour
+{
+ private AnimationHandler animHandler;
+
+ private Collider collider;
+
+ public PhysicMaterial slippery;
+
+ private PhysicMaterial footMaterial;
+
+ private Transform torso;
+
+ private MovementDataHandler moveData;
+
+ private Rigidbody rig;
+
+ private RotationHandler rot;
+
+ private Vector3 rotationDif;
+
+ private AnimationObject anim;
+
+ private StepHandler handler;
+
+ private void Start()
+ {
+ animHandler = base.transform.root.GetComponent<AnimationHandler>();
+ moveData = base.transform.root.GetComponent<MovementDataHandler>();
+ collider = GetComponentInChildren<Collider>();
+ rig = GetComponent<Rigidbody>();
+ footMaterial = collider.material;
+ torso = base.transform.root.GetComponentInChildren<Torso>().transform;
+ rot = base.transform.root.GetComponent<RotationHandler>();
+ handler = base.transform.root.GetComponent<StepHandler>();
+ anim = GetComponentInChildren<AnimationObject>();
+ }
+
+ private void Update()
+ {
+ float num = Mathf.Abs(torso.position.x - base.transform.position.x) + Mathf.Abs(torso.position.z - base.transform.position.z);
+ if (rot.hipCorrectionAmount > 30f || ((bool)anim && anim.isLeft != handler.isLeft))
+ {
+ SetFoot(active: false);
+ }
+ else if (animHandler.animationState == 0)
+ {
+ if (num > 0.1f || rotationDif.magnitude > 15f)
+ {
+ SetFoot(active: false);
+ }
+ else
+ {
+ SetFoot(active: true);
+ }
+ }
+ else
+ {
+ SetFoot(active: true);
+ }
+ }
+
+ private void FixedUpdate()
+ {
+ }
+
+ private void SetFoot(bool active)
+ {
+ if (active)
+ {
+ collider.material = footMaterial;
+ }
+ }
+}
diff --git a/_ActiveRagdoll/Gravity.cs b/_ActiveRagdoll/Gravity.cs
new file mode 100644
index 0000000..f646f0c
--- /dev/null
+++ b/_ActiveRagdoll/Gravity.cs
@@ -0,0 +1,47 @@
+using UnityEngine;
+
+public class Gravity : MonoBehaviour
+{
+ public float baseGravity;
+
+ public float scalingGravity;
+
+ private RigidbodyHolder allRigs;
+
+ private StandingDataHandler standingData;
+
+ private Holding holding;
+
+ private PlayerDeath death;
+
+ private void Start()
+ {
+ death = GetComponent<PlayerDeath>();
+ allRigs = GetComponent<RigidbodyHolder>();
+ standingData = GetComponent<StandingDataHandler>();
+ holding = GetComponent<Holding>();
+ }
+
+ private void FixedUpdate()
+ {
+ if (death.dead)
+ {
+ return;
+ }
+ for (int i = 0; i < allRigs.GetAllRigs().Length; i++)
+ {
+ allRigs.GetAllRigs()[i].AddForce(Vector3.down * baseGravity + Vector3.down * scalingGravity * standingData.sinceGrounded, ForceMode.Acceleration);
+ }
+ if ((bool)holding)
+ {
+ if ((bool)holding.heldObject)
+ {
+ holding.heldObject.rig.AddForce(Vector3.down * baseGravity + Vector3.down * scalingGravity * standingData.sinceGrounded, ForceMode.Acceleration);
+ }
+ if ((bool)holding.heldObjectOffHand)
+ {
+ holding.heldObjectOffHand.rig.AddForce(Vector3.down * baseGravity + Vector3.down * scalingGravity * standingData.sinceGrounded, ForceMode.Acceleration);
+ }
+ }
+ }
+}
diff --git a/_ActiveRagdoll/HandLeft.cs b/_ActiveRagdoll/HandLeft.cs
new file mode 100644
index 0000000..5f92108
--- /dev/null
+++ b/_ActiveRagdoll/HandLeft.cs
@@ -0,0 +1,12 @@
+using UnityEngine;
+
+public class HandLeft : MonoBehaviour
+{
+ private void Start()
+ {
+ }
+
+ private void Update()
+ {
+ }
+}
diff --git a/_ActiveRagdoll/HandRight.cs b/_ActiveRagdoll/HandRight.cs
new file mode 100644
index 0000000..cb78d06
--- /dev/null
+++ b/_ActiveRagdoll/HandRight.cs
@@ -0,0 +1,12 @@
+using UnityEngine;
+
+public class HandRight : MonoBehaviour
+{
+ private void Start()
+ {
+ }
+
+ private void Update()
+ {
+ }
+}
diff --git a/_ActiveRagdoll/HasControl.cs b/_ActiveRagdoll/HasControl.cs
new file mode 100644
index 0000000..dde8ad6
--- /dev/null
+++ b/_ActiveRagdoll/HasControl.cs
@@ -0,0 +1,28 @@
+using UnityEngine;
+
+public class HasControl : MonoBehaviour
+{
+ public bool hasControl = true;
+
+ public GameObject[] objectsToRemove;
+
+ private void Awake()
+ {
+ UpdateControl();
+ }
+
+ private void UpdateControl()
+ {
+ GameObject[] array = objectsToRemove;
+ foreach (GameObject gameObject in array)
+ {
+ gameObject.SetActive(hasControl);
+ }
+ }
+
+ public void ChangeControl(bool control)
+ {
+ hasControl = control;
+ UpdateControl();
+ }
+}
diff --git a/_ActiveRagdoll/Head.cs b/_ActiveRagdoll/Head.cs
new file mode 100644
index 0000000..ce81442
--- /dev/null
+++ b/_ActiveRagdoll/Head.cs
@@ -0,0 +1,12 @@
+using UnityEngine;
+
+public class Head : MonoBehaviour
+{
+ private void Start()
+ {
+ }
+
+ private void Update()
+ {
+ }
+}
diff --git a/_ActiveRagdoll/HeadCollisionHandler.cs b/_ActiveRagdoll/HeadCollisionHandler.cs
new file mode 100644
index 0000000..c929f0e
--- /dev/null
+++ b/_ActiveRagdoll/HeadCollisionHandler.cs
@@ -0,0 +1,31 @@
+using UnityEngine;
+
+public class HeadCollisionHandler : MonoBehaviour
+{
+ public float collisionValue;
+
+ private void Start()
+ {
+ }
+
+ private void Update()
+ {
+ collisionValue = Mathf.Lerp(collisionValue, 0f, Time.deltaTime * 6f);
+ }
+
+ private void OnCollisionEnter(Collision collision)
+ {
+ if (!(collision.transform.root == base.transform.root))
+ {
+ collisionValue += collision.relativeVelocity.magnitude * 0.5f;
+ }
+ }
+
+ private void OnCollisionStay(Collision collision)
+ {
+ if (!(collision.transform.root == base.transform.root))
+ {
+ collisionValue += collision.relativeVelocity.magnitude * 0.1f;
+ }
+ }
+}
diff --git a/_ActiveRagdoll/Hip.cs b/_ActiveRagdoll/Hip.cs
new file mode 100644
index 0000000..379fb1d
--- /dev/null
+++ b/_ActiveRagdoll/Hip.cs
@@ -0,0 +1,12 @@
+using UnityEngine;
+
+public class Hip : MonoBehaviour
+{
+ private void Start()
+ {
+ }
+
+ private void Update()
+ {
+ }
+}
diff --git a/_ActiveRagdoll/Holding.cs b/_ActiveRagdoll/Holding.cs
new file mode 100644
index 0000000..dafc08b
--- /dev/null
+++ b/_ActiveRagdoll/Holding.cs
@@ -0,0 +1,288 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+public class Holding : MonoBehaviour
+{
+ [HideInInspector]
+ public HoldableObject heldObject;
+
+ [HideInInspector]
+ public HoldableObject heldObjectOffHand;
+
+ [HideInInspector]
+ public Transform baseTransform;
+
+ private Rigidbody rightHand;
+
+ private Rigidbody leftHand;
+
+ [HideInInspector]
+ public ConfigurableJoint leftHandJoint;
+
+ [HideInInspector]
+ public ConfigurableJoint rightHandJoint;
+
+ public float grabForce;
+
+ [HideInInspector]
+ public bool isGrabbing;
+
+ private Transform rotaionTarget;
+
+ private bool hasMainHandWeapon;
+
+ private PlayerDeath death;
+
+ public LayerMask mask = default(LayerMask);
+
+ private Strength str;
+
+ private float strength = 1f;
+
+ private PID leftHandPID;
+
+ private PID rightHandPID;
+
+ private StandingDataHandler standingData;
+
+ private void Awake()
+ {
+ death = GetComponent<PlayerDeath>();
+ standingData = GetComponent<StandingDataHandler>();
+ str = GetComponent<Strength>();
+ if (!baseTransform)
+ {
+ baseTransform = GetComponentInChildren<HoldingBaseTransform>().transform;
+ }
+ rightHand = GetComponentInChildren<HandRight>().GetComponent<Rigidbody>();
+ leftHand = GetComponentInChildren<HandLeft>().GetComponent<Rigidbody>();
+ rotaionTarget = base.transform.GetComponentInChildren<RotationTarget>().transform;
+ mask = LayerMask.GetMask("Map");
+ leftHandPID = leftHand.GetComponent<PID>();
+ rightHandPID = rightHand.GetComponent<PID>();
+ }
+
+ private void Update()
+ {
+ if (!death.dead && (bool)heldObject)
+ {
+ strength = str.strength;
+ if (((bool)rightHandJoint || !heldObject.rightHandPos) && ((bool)leftHandJoint || !heldObject.leftHandPos) && (!heldObjectOffHand || (((bool)rightHandJoint || !heldObjectOffHand.rightHandPos) && ((bool)leftHandJoint || !heldObjectOffHand.leftHandPos))))
+ {
+ isGrabbing = false;
+ }
+ }
+ }
+
+ private void FixedUpdate()
+ {
+ if (death.dead || isGrabbing)
+ {
+ return;
+ }
+ if ((bool)heldObject)
+ {
+ HoldObjectInPlace(heldObject.rig, heldObject, offHand: false, rightHand);
+ if (!heldObjectOffHand && (bool)leftHandJoint)
+ {
+ HoldObjectInPlace(heldObject.rig, heldObject, offHand: false, leftHand, justHand: true);
+ }
+ }
+ if ((bool)heldObjectOffHand)
+ {
+ HoldObjectInPlace(heldObjectOffHand.rig, heldObjectOffHand, offHand: true, leftHand);
+ }
+ }
+
+ private void HoldObjectInPlace(Rigidbody rigi, HoldableObject held, bool offHand, Rigidbody hand, bool justHand = false)
+ {
+ Vector3 holdingPosition = held.holdingPosition;
+ if (offHand)
+ {
+ holdingPosition.x *= -1f;
+ }
+ holdingPosition = baseTransform.TransformPoint(holdingPosition);
+ Vector3 holdingRotation = held.holdingRotation;
+ Vector3 targetRotation = baseTransform.TransformDirection(holdingRotation);
+ Vector3 targetRotationUp = baseTransform.TransformDirection(held.holdingUpRotation);
+ if (!justHand)
+ {
+ held.pid.DoPID(holdingPosition, targetRotation, targetRotationUp, strength);
+ }
+ PID pID = rightHandPID;
+ Vector3 localPosition = held.rightHandPos.localPosition;
+ if (hand == leftHand)
+ {
+ localPosition = held.leftHandPos.localPosition;
+ pID = leftHandPID;
+ }
+ Vector3 position = held.holdingPosition + localPosition;
+ if (offHand)
+ {
+ position.x *= -1f;
+ }
+ position = baseTransform.TransformPoint(position);
+ Debug.DrawLine(position, position + Vector3.up);
+ Debug.DrawLine(holdingPosition, holdingPosition + Vector3.up);
+ pID.DoPID(position, Vector3.zero, Vector3.zero, strength);
+ }
+
+ public void StartHolding(HoldableObject holdableObject, bool hasOffHand)
+ {
+ holdableObject.isHeld = true;
+ isGrabbing = true;
+ bool offHand = false;
+ if (!hasMainHandWeapon)
+ {
+ hasMainHandWeapon = true;
+ heldObject = holdableObject;
+ if ((bool)heldObject.rightHandPos)
+ {
+ StartCoroutine(Grab(mainHand: true, rightHand, heldObject, offHand: false));
+ }
+ if ((bool)heldObject.leftHandPos && !hasOffHand)
+ {
+ StartCoroutine(Grab(mainHand: false, leftHand, heldObject, offHand: false));
+ }
+ }
+ else
+ {
+ offHand = true;
+ heldObjectOffHand = holdableObject;
+ heldObjectOffHand.leftHandPos = heldObjectOffHand.rightHandPos;
+ if ((bool)heldObjectOffHand.rightHandPos)
+ {
+ StartCoroutine(Grab(mainHand: false, leftHand, heldObjectOffHand, offHand: true));
+ }
+ }
+ StartCoroutine(HoldweaponStill(holdableObject.rig, offHand, holdableObject));
+ }
+
+ private IEnumerator Grab(bool mainHand, Rigidbody hand, HoldableObject held, bool offHand)
+ {
+ while (isGrabbing)
+ {
+ if (mainHand)
+ {
+ if (!rightHandJoint)
+ {
+ ReachForPoint(rightHand, rightHand.transform.GetChild(0).position, held.rightHandPos, isLeft: false, held.rig, held, offHand);
+ rightHand.GetComponentInChildren<Collider>().enabled = false;
+ }
+ }
+ else if (!leftHandJoint)
+ {
+ ReachForPoint(leftHand, leftHand.transform.GetChild(0).position, held.leftHandPos, isLeft: true, held.rig, held, offHand);
+ leftHand.GetComponentInChildren<Collider>().enabled = false;
+ }
+ yield return null;
+ }
+ leftHand.GetComponentInChildren<Collider>().enabled = true;
+ rightHand.GetComponentInChildren<Collider>().enabled = true;
+ }
+
+ private IEnumerator HoldweaponStill(Rigidbody rigToGrab, bool offHand, HoldableObject held)
+ {
+ while (isGrabbing)
+ {
+ Vector3 pos = held.holdingPosition;
+ if (offHand)
+ {
+ pos.x *= -1f;
+ }
+ rigToGrab.transform.position = baseTransform.TransformPoint(pos);
+ rigToGrab.transform.rotation = Quaternion.LookRotation(baseTransform.TransformDirection(heldObject.holdingRotation));
+ yield return null;
+ }
+ }
+
+ public void Drop()
+ {
+ List<HoldableObject> list = new List<HoldableObject>();
+ if ((bool)heldObject)
+ {
+ list.Add(heldObject);
+ }
+ if ((bool)heldObjectOffHand)
+ {
+ list.Add(heldObjectOffHand);
+ }
+ for (int i = 0; i < list.Count; i++)
+ {
+ list[i].holder = null;
+ list[i].isHeld = false;
+ list[i].rig.useGravity = true;
+ list[i].rig.drag = 0f;
+ list[i].rig.angularDrag = 0f;
+ Collider[] componentsInChildren = list[i].GetComponentsInChildren<Collider>();
+ foreach (Collider collider in componentsInChildren)
+ {
+ collider.material = null;
+ }
+ }
+ heldObject = null;
+ heldObjectOffHand = null;
+ if ((bool)rightHandJoint)
+ {
+ Object.Destroy(rightHandJoint);
+ }
+ if ((bool)leftHandJoint)
+ {
+ Object.Destroy(leftHandJoint);
+ }
+ hasMainHandWeapon = false;
+ }
+
+ private void ReachForPoint(Rigidbody rigToReach, Vector3 forcePosition, Transform targetPositionTransform, bool isLeft, Rigidbody rigToGrab, HoldableObject held, bool offHand)
+ {
+ Vector3 normalized = (targetPositionTransform.position - forcePosition).normalized;
+ rigToReach.AddForceAtPosition(normalized * grabForce * Mathf.Clamp(Time.deltaTime, 0f, 0.1f), forcePosition, ForceMode.Acceleration);
+ if (Vector3.Distance(targetPositionTransform.position, forcePosition) < 0.5f)
+ {
+ ConnectRig(rigToReach, rigToGrab, targetPositionTransform, isLeft, held, offHand);
+ }
+ }
+
+ private void ConnectRig(Rigidbody startRig, Rigidbody targetRig, Transform targetPositionTransform, bool isLeft, HoldableObject held, bool offHand)
+ {
+ ConfigurableJoint configurableJoint = startRig.gameObject.AddComponent<ConfigurableJoint>();
+ if (offHand)
+ {
+ targetPositionTransform.localRotation = Quaternion.Euler(targetPositionTransform.localEulerAngles.x, 0f - targetPositionTransform.localEulerAngles.y, targetPositionTransform.localEulerAngles.z);
+ }
+ startRig.transform.rotation = targetPositionTransform.rotation;
+ startRig.transform.position += targetPositionTransform.position - startRig.transform.GetChild(0).position;
+ configurableJoint.connectedBody = targetRig;
+ configurableJoint.projectionMode = JointProjectionMode.PositionAndRotation;
+ configurableJoint.xMotion = ConfigurableJointMotion.Locked;
+ configurableJoint.yMotion = ConfigurableJointMotion.Locked;
+ configurableJoint.zMotion = ConfigurableJointMotion.Locked;
+ configurableJoint.angularXMotion = ConfigurableJointMotion.Limited;
+ configurableJoint.angularYMotion = ConfigurableJointMotion.Limited;
+ configurableJoint.angularZMotion = ConfigurableJointMotion.Limited;
+ SoftJointLimit highAngularXLimit = configurableJoint.highAngularXLimit;
+ highAngularXLimit.limit = held.swingAngles.y;
+ configurableJoint.highAngularXLimit = highAngularXLimit;
+ highAngularXLimit.limit = held.swingAngles.x;
+ configurableJoint.lowAngularXLimit = highAngularXLimit;
+ highAngularXLimit.limit = held.twistAngles.x;
+ configurableJoint.angularYLimit = highAngularXLimit;
+ highAngularXLimit.limit = held.twistAngles.y;
+ configurableJoint.angularZLimit = highAngularXLimit;
+ SoftJointLimitSpring angularXLimitSpring = configurableJoint.angularXLimitSpring;
+ angularXLimitSpring.spring = held.swingSpring;
+ configurableJoint.angularXLimitSpring = angularXLimitSpring;
+ angularXLimitSpring.spring = held.twistSpring;
+ configurableJoint.angularYZLimitSpring = angularXLimitSpring;
+ configurableJoint.anchor = startRig.transform.InverseTransformPoint(startRig.transform.GetChild(0).position);
+ if (isLeft)
+ {
+ leftHandJoint = configurableJoint;
+ }
+ else
+ {
+ rightHandJoint = configurableJoint;
+ }
+ }
+}
diff --git a/_ActiveRagdoll/InputHandler.cs b/_ActiveRagdoll/InputHandler.cs
new file mode 100644
index 0000000..27adc82
--- /dev/null
+++ b/_ActiveRagdoll/InputHandler.cs
@@ -0,0 +1,120 @@
+using UnityEngine;
+
+public class InputHandler : MonoBehaviour
+{
+ public Vector3 inputMovementDirection;
+
+ public Vector3 lastInputDirection;
+
+ public bool isSpringting;
+
+ private WeaponHandler wepaonHandler;
+
+ private MovementDataHandler movementData;
+
+ private WeaponHandler weaponHandler;
+
+ private CameraMovement cameraMovement;
+
+ private PlayerDeath death;
+
+ private HasControl hasControl;
+
+ private MovementHandler movement;
+
+ public bool allowStrafe = true;
+
+ private void Start()
+ {
+ death = GetComponent<PlayerDeath>();
+ movement = GetComponent<MovementHandler>();
+ wepaonHandler = GetComponent<WeaponHandler>();
+ hasControl = GetComponent<HasControl>();
+ movementData = GetComponent<MovementDataHandler>();
+ weaponHandler = GetComponent<WeaponHandler>();
+ cameraMovement = GetComponentInChildren<CameraMovement>();
+ }
+
+ private void Update()
+ {
+ if ((bool)death && death.dead)
+ {
+ return;
+ }
+ if (!hasControl || hasControl.hasControl)
+ {
+ isSpringting = false;
+ inputMovementDirection = Vector3.zero;
+ if (Input.GetKey(KeyCode.W))
+ {
+ inputMovementDirection += movementData.groundedForward;
+ }
+ if (Input.GetKey(KeyCode.S))
+ {
+ inputMovementDirection += movementData.groundedBack;
+ }
+ if (Input.GetKey(KeyCode.D) && allowStrafe)
+ {
+ inputMovementDirection += movementData.right;
+ }
+ if (Input.GetKey(KeyCode.A) && allowStrafe)
+ {
+ inputMovementDirection += movementData.left;
+ }
+ if (Input.GetKey(KeyCode.LeftShift) && (!cameraMovement || !cameraMovement.ADS))
+ {
+ isSpringting = true;
+ }
+ inputMovementDirection = inputMovementDirection.normalized;
+ if ((bool)movement && Input.GetKeyDown(KeyCode.Space))
+ {
+ movement.Jump();
+ }
+ if ((bool)weaponHandler)
+ {
+ if (weaponHandler.isDualWeilding)
+ {
+ if (Input.GetKey(KeyCode.Mouse1))
+ {
+ weaponHandler.HoldAttack(shootWithRightGun: true, ADS: false);
+ }
+ if (Input.GetKeyDown(KeyCode.Mouse1))
+ {
+ weaponHandler.PressAttack(shootWithRightGun: true, ADS: false);
+ }
+ if (Input.GetKey(KeyCode.Mouse0))
+ {
+ weaponHandler.HoldAttack(shootWithRightGun: false, ADS: false);
+ }
+ if (Input.GetKeyDown(KeyCode.Mouse0))
+ {
+ weaponHandler.PressAttack(shootWithRightGun: false, ADS: false);
+ }
+ }
+ else
+ {
+ if (Input.GetKey(KeyCode.Mouse1))
+ {
+ cameraMovement.ADS = true;
+ }
+ else
+ {
+ cameraMovement.ADS = false;
+ }
+ if (Input.GetKey(KeyCode.Mouse0))
+ {
+ weaponHandler.HoldAttack(shootWithRightGun: true, cameraMovement.ADS);
+ }
+ if (Input.GetKeyDown(KeyCode.Mouse0))
+ {
+ weaponHandler.PressAttack(shootWithRightGun: true, cameraMovement.ADS);
+ }
+ }
+ }
+ }
+ if (inputMovementDirection != Vector3.zero)
+ {
+ lastInputDirection = inputMovementDirection;
+ }
+ }
+}
diff --git a/_ActiveRagdoll/LeftHandPos.cs b/_ActiveRagdoll/LeftHandPos.cs
new file mode 100644
index 0000000..955cf44
--- /dev/null
+++ b/_ActiveRagdoll/LeftHandPos.cs
@@ -0,0 +1,12 @@
+using UnityEngine;
+
+public class LeftHandPos : MonoBehaviour
+{
+ private void Start()
+ {
+ }
+
+ private void Update()
+ {
+ }
+}
diff --git a/_ActiveRagdoll/MovementDataHandler.cs b/_ActiveRagdoll/MovementDataHandler.cs
new file mode 100644
index 0000000..18d43f5
--- /dev/null
+++ b/_ActiveRagdoll/MovementDataHandler.cs
@@ -0,0 +1,92 @@
+using UnityEngine;
+
+public class MovementDataHandler : MonoBehaviour
+{
+ [HideInInspector]
+ public Vector3 groundedForward;
+
+ [HideInInspector]
+ public Vector3 right;
+
+ [HideInInspector]
+ public Vector3 left;
+
+ [HideInInspector]
+ public Vector3 groundedBack;
+
+ private Transform hip;
+
+ private Transform torso;
+
+ public Transform rotationTarget;
+
+ [HideInInspector]
+ public float slopeStrenght;
+
+ public float slopeVelocityStrenght;
+
+ [HideInInspector]
+ public float sinceJump = 1f;
+
+ [HideInInspector]
+ public Vector3 groundNormal;
+
+ private InputHandler inputHandler;
+
+ private Transform leftKnee;
+
+ private Transform rightKnee;
+
+ private void Start()
+ {
+ inputHandler = GetComponent<InputHandler>();
+ hip = GetComponentInChildren<Hip>().transform;
+ torso = GetComponentInChildren<Torso>().transform;
+ if (!rotationTarget)
+ {
+ rotationTarget = GetComponentInChildren<RotationTarget>().transform;
+ }
+ KneeLeft componentInChildren = GetComponentInChildren<KneeLeft>();
+ if ((bool)componentInChildren)
+ {
+ leftKnee = componentInChildren.transform;
+ }
+ KneeRight componentInChildren2 = GetComponentInChildren<KneeRight>();
+ if ((bool)componentInChildren2)
+ {
+ rightKnee = componentInChildren2.transform;
+ }
+ }
+
+ private void Update()
+ {
+ sinceJump += Time.deltaTime;
+ groundedForward = rotationTarget.forward;
+ groundedForward.y = slopeStrenght * 1f;
+ groundedForward = groundedForward.normalized;
+ groundedBack = -groundedForward;
+ right = rotationTarget.right;
+ left = -rotationTarget.right;
+ slopeStrenght = Mathf.Lerp(slopeStrenght, 0f, Time.deltaTime * 1f);
+ Debug.DrawLine(hip.position, hip.position + groundedForward * 10f);
+ }
+
+ public void SetSlope(Vector3 normal)
+ {
+ groundNormal = normal;
+ slopeStrenght = Vector3.Cross(rotationTarget.right, normal).y;
+ Vector3 lhs = Vector3.Cross(Vector3.up, inputHandler.inputMovementDirection);
+ slopeVelocityStrenght = Vector3.Cross(lhs, normal).y;
+ }
+
+ public float GetSmallestLegAngle()
+ {
+ float num = Vector3.Angle(leftKnee.forward, Vector3.down);
+ float num2 = Vector3.Angle(rightKnee.forward, Vector3.down);
+ if (num < num2)
+ {
+ return num;
+ }
+ return num2;
+ }
+}
diff --git a/_ActiveRagdoll/MovementHandler.cs b/_ActiveRagdoll/MovementHandler.cs
new file mode 100644
index 0000000..22795f7
--- /dev/null
+++ b/_ActiveRagdoll/MovementHandler.cs
@@ -0,0 +1,85 @@
+using System.Collections;
+using UnityEngine;
+
+public class MovementHandler : MonoBehaviour
+{
+ private InputHandler inputHandler;
+
+ public float friction = 0.9f;
+
+ public Vector3 movementVector;
+
+ public float[] animationForceAmounts;
+
+ private AnimationHandler animationHandler;
+
+ private RigidbodyHolder allRigs;
+
+ public AnimationCurve jumpCurve;
+
+ public float jumpForce;
+
+ private StandingDataHandler standingData;
+
+ private MovementDataHandler data;
+
+ private PlayerDeath death;
+
+ [HideInInspector]
+ public float multiplier = 1f;
+
+ private WobbleShake wobbleShake;
+
+ private void Start()
+ {
+ wobbleShake = GetComponentInChildren<WobbleShake>();
+ death = GetComponent<PlayerDeath>();
+ standingData = GetComponent<StandingDataHandler>();
+ inputHandler = GetComponent<InputHandler>();
+ animationHandler = GetComponent<AnimationHandler>();
+ allRigs = GetComponent<RigidbodyHolder>();
+ data = GetComponent<MovementDataHandler>();
+ }
+
+ private void FixedUpdate()
+ {
+ if (!death.dead)
+ {
+ data.sinceJump += Time.fixedDeltaTime;
+ movementVector += inputHandler.inputMovementDirection * animationForceAmounts[animationHandler.animationState];
+ movementVector *= friction;
+ for (int i = 0; i < allRigs.GetAllRigs().Length; i++)
+ {
+ allRigs.GetAllRigs()[i].AddForce(movementVector * multiplier, ForceMode.Acceleration);
+ }
+ }
+ }
+
+ public void Jump()
+ {
+ if (!(data.sinceJump < 0.5f) && !(standingData.sinceGrounded > 0.3f))
+ {
+ data.sinceJump = 0f;
+ StartCoroutine(AddJumpForce());
+ wobbleShake.AddShake(Vector3.up * 2f, 0.8f);
+ }
+ }
+
+ private IEnumerator AddJumpForce()
+ {
+ float counter = 0f;
+ for (int i = 0; i < allRigs.GetAllRigs().Length; i++)
+ {
+ allRigs.GetAllRigs()[i].velocity = new Vector3(allRigs.GetAllRigs()[i].velocity.x, 0f, allRigs.GetAllRigs()[i].velocity.z);
+ }
+ while (counter < jumpCurve.keys[jumpCurve.length - 1].time && !death.dead)
+ {
+ counter += Time.deltaTime;
+ for (int j = 0; j < allRigs.GetAllRigs().Length; j++)
+ {
+ allRigs.GetAllRigs()[j].AddForce(Vector3.up * multiplier * jumpForce * jumpCurve.Evaluate(counter) * Time.deltaTime, ForceMode.Acceleration);
+ }
+ yield return null;
+ }
+ }
+}
diff --git a/_ActiveRagdoll/PickupHandler.cs b/_ActiveRagdoll/PickupHandler.cs
new file mode 100644
index 0000000..8bf1615
--- /dev/null
+++ b/_ActiveRagdoll/PickupHandler.cs
@@ -0,0 +1,63 @@
+using UnityEngine;
+
+public class PickupHandler : MonoBehaviour
+{
+ public Pickup setWeapon;
+
+ public Pickup setWeapon2;
+
+ private WeaponHandler weaponHandler;
+
+ private Holding holding;
+
+ private float counter;
+
+ private void Start()
+ {
+ weaponHandler = GetComponent<WeaponHandler>();
+ holding = GetComponent<Holding>();
+ if ((bool)setWeapon)
+ {
+ PickUp(setWeapon);
+ }
+ if ((bool)setWeapon2)
+ {
+ PickUp2(setWeapon2);
+ }
+ }
+
+ private void Update()
+ {
+ counter += Time.deltaTime;
+ }
+
+ public void PickUp(Pickup objectToPickUp)
+ {
+ if (!(counter < 1f))
+ {
+ counter = 0f;
+ holding.Drop();
+ Weapon component = objectToPickUp.GetComponent<Weapon>();
+ Gun component2 = component.GetComponent<Gun>();
+ weaponHandler.SetGun(component2, mainHand: true);
+ bool hasOffHand = false;
+ if ((bool)setWeapon2)
+ {
+ hasOffHand = true;
+ }
+ HoldableObject component3 = component.GetComponent<HoldableObject>();
+ component3.holder = base.transform;
+ holding.StartHolding(component3, hasOffHand);
+ }
+ }
+
+ public void PickUp2(Pickup objectToPickUp)
+ {
+ Weapon component = objectToPickUp.GetComponent<Weapon>();
+ Gun component2 = component.GetComponent<Gun>();
+ weaponHandler.SetGun(component2, mainHand: false);
+ HoldableObject component3 = component.GetComponent<HoldableObject>();
+ component3.holder = base.transform;
+ holding.StartHolding(component3, hasOffHand: true);
+ }
+}
diff --git a/_ActiveRagdoll/Player.cs b/_ActiveRagdoll/Player.cs
new file mode 100644
index 0000000..55ff387
--- /dev/null
+++ b/_ActiveRagdoll/Player.cs
@@ -0,0 +1,18 @@
+using UnityEngine;
+
+public class Player : MonoBehaviour
+{
+ public static Player localPlayer;
+
+ public bool isLocalPlayer;
+
+ public Transform torso;
+
+ private void Start()
+ {
+ if (isLocalPlayer)
+ {
+ localPlayer = this;
+ }
+ }
+}
diff --git a/_ActiveRagdoll/PlayerDeath.cs b/_ActiveRagdoll/PlayerDeath.cs
new file mode 100644
index 0000000..ec0813a
--- /dev/null
+++ b/_ActiveRagdoll/PlayerDeath.cs
@@ -0,0 +1,125 @@
+using UnityEngine;
+
+public class PlayerDeath : MonoBehaviour
+{
+ public bool dead;
+
+ private bool isFrozen;
+
+ public float muscleFunction = 1f;
+
+ public bool terminalState;
+
+ private DamageEffects damageEffects;
+
+ private RagdollHandler ragdoll;
+
+ private Transform hip;
+
+ public float health = 100f;
+
+ public ParticleSystem[] damageParticles;
+
+ private HasControl hasControll;
+
+ private Holding holding;
+
+ private void Start()
+ {
+ damageEffects = GetComponent<DamageEffects>();
+ ragdoll = GetComponent<RagdollHandler>();
+ hip = GetComponentInChildren<Hip>().transform;
+ hasControll = GetComponent<HasControl>();
+ holding = GetComponent<Holding>();
+ }
+
+ private void Update()
+ {
+ if (health < 100f)
+ {
+ health += Time.deltaTime * 10f;
+ health = Mathf.Clamp(health, -10f, 100f);
+ }
+ if (hip.transform.position.y < -10f)
+ {
+ Die();
+ }
+ if (terminalState && muscleFunction > 0f)
+ {
+ muscleFunction -= Time.deltaTime * 1f;
+ }
+ if (muscleFunction < 0f && !isFrozen)
+ {
+ FreezeBody();
+ }
+ }
+
+ public void TakeDamage(Vector3 damage, Vector3 hitPoint, Rigidbody hitRig = null)
+ {
+ if (hasControll.hasControl)
+ {
+ damageEffects.TakeDamage(damage, hitPoint);
+ }
+ if (hitPoint != Vector3.zero)
+ {
+ for (int i = 0; i < damageParticles.Length; i++)
+ {
+ damageParticles[i].transform.rotation = Quaternion.LookRotation(damage);
+ damageParticles[i].transform.position = hitPoint;
+ damageParticles[i].Play();
+ }
+ }
+ health -= damage.magnitude;
+ if (!(health <= 0f))
+ {
+ return;
+ }
+ if ((bool)hitRig)
+ {
+ ConfigurableJoint component = hitRig.GetComponent<ConfigurableJoint>();
+ if ((bool)component)
+ {
+ Object.Destroy(component);
+ }
+ }
+ Kill();
+ }
+
+ public void FreezeBody()
+ {
+ isFrozen = true;
+ Joint[] componentsInChildren = GetComponentsInChildren<Joint>();
+ for (int i = 0; i < componentsInChildren.Length; i++)
+ {
+ ConfigurableJoint configurableJoint = (ConfigurableJoint)componentsInChildren[i];
+ Rigidbody component = configurableJoint.GetComponent<Rigidbody>();
+ JointDrive angularXDrive = configurableJoint.angularXDrive;
+ angularXDrive.positionSpring = 5f * component.mass;
+ angularXDrive.positionDamper = 1f * component.mass;
+ configurableJoint.angularXDrive = angularXDrive;
+ configurableJoint.angularYZDrive = angularXDrive;
+ configurableJoint.SetTargetRotationLocal(configurableJoint.transform.localRotation, configurableJoint.gameObject.GetComponent<StartRotation>().startRotationLocal);
+ }
+ }
+
+ public void Die()
+ {
+ if (!dead)
+ {
+ holding.Drop();
+ dead = true;
+ ragdoll.ragdollValue = 0f;
+ Collider[] componentsInChildren = GetComponentsInChildren<Collider>();
+ foreach (Collider collider in componentsInChildren)
+ {
+ collider.material = null;
+ }
+ }
+ }
+
+ public void Kill()
+ {
+ terminalState = true;
+ Die();
+ }
+}
diff --git a/_ActiveRagdoll/PlayerKnockback.cs b/_ActiveRagdoll/PlayerKnockback.cs
new file mode 100644
index 0000000..89fffb8
--- /dev/null
+++ b/_ActiveRagdoll/PlayerKnockback.cs
@@ -0,0 +1,52 @@
+using UnityEngine;
+
+public class PlayerKnockback : MonoBehaviour
+{
+ private RigidbodyHolder allRigs;
+
+ private StandingDataHandler standing;
+
+ private WeaponHandler weapons;
+
+ private void Start()
+ {
+ allRigs = GetComponent<RigidbodyHolder>();
+ standing = GetComponent<StandingDataHandler>();
+ weapons = GetComponent<WeaponHandler>();
+ }
+
+ private void Update()
+ {
+ if (Input.GetKeyDown(KeyCode.K))
+ {
+ AddSeriousKnockback();
+ }
+ }
+
+ public void AddForce(Vector3 force, Rigidbody rig)
+ {
+ if (force.magnitude > 200f)
+ {
+ AddSeriousKnockback();
+ force *= 0.1f;
+ }
+ for (int i = 0; i < allRigs.GetAllRigs().Length; i++)
+ {
+ float num = 1f;
+ if (rig == allRigs.GetAllRigs()[i])
+ {
+ num *= 1f;
+ }
+ allRigs.GetAllRigs()[i].AddForce(force * num * 20f, ForceMode.Acceleration);
+ }
+ }
+
+ private void AddSeriousKnockback()
+ {
+ GetComponent<PlayerDeath>().Kill();
+ }
+
+ private void AddNormalKnockback()
+ {
+ }
+}
diff --git a/_ActiveRagdoll/RagdollHandler.cs b/_ActiveRagdoll/RagdollHandler.cs
new file mode 100644
index 0000000..ca52b8d
--- /dev/null
+++ b/_ActiveRagdoll/RagdollHandler.cs
@@ -0,0 +1,21 @@
+using UnityEngine;
+
+public class RagdollHandler : MonoBehaviour
+{
+ public float ragdollValue = 1f;
+
+ private RigidbodyHolder rigs;
+
+ private void Start()
+ {
+ rigs = GetComponent<RigidbodyHolder>();
+ }
+
+ private void Update()
+ {
+ for (int i = 0; i < rigs.GetAllRigs().Length; i++)
+ {
+ rigs.GetAllRigs()[i].GetComponent<DragHandler>().dragAmount = ragdollValue;
+ }
+ }
+}
diff --git a/_ActiveRagdoll/RemoveMouse.cs b/_ActiveRagdoll/RemoveMouse.cs
new file mode 100644
index 0000000..85d89db
--- /dev/null
+++ b/_ActiveRagdoll/RemoveMouse.cs
@@ -0,0 +1,17 @@
+using UnityEngine;
+
+public class RemoveMouse : MonoBehaviour
+{
+ private void Start()
+ {
+ }
+
+ private void Update()
+ {
+ if (Input.GetKey(KeyCode.Mouse1))
+ {
+ Cursor.lockState = CursorLockMode.Locked;
+ Cursor.visible = false;
+ }
+ }
+}
diff --git a/_ActiveRagdoll/RigidbodyHolder.cs b/_ActiveRagdoll/RigidbodyHolder.cs
new file mode 100644
index 0000000..796f77a
--- /dev/null
+++ b/_ActiveRagdoll/RigidbodyHolder.cs
@@ -0,0 +1,44 @@
+using System.Collections.Generic;
+using UnityEngine;
+
+public class RigidbodyHolder : MonoBehaviour
+{
+ private Rigidbody[] allRigs;
+
+ private WeaponHandler weapons;
+
+ private void Start()
+ {
+ allRigs = GetComponentsInChildren<Rigidbody>();
+ weapons = GetComponent<WeaponHandler>();
+ }
+
+ private void Update()
+ {
+ }
+
+ public Rigidbody[] GetAllRigs()
+ {
+ if (!weapons.leftGun && !weapons.rightGun)
+ {
+ return allRigs;
+ }
+ List<Rigidbody> list = new List<Rigidbody>();
+ for (int i = 0; i < allRigs.Length; i++)
+ {
+ list.Add(allRigs[i]);
+ }
+ if ((bool)weapons)
+ {
+ if ((bool)weapons.leftGun)
+ {
+ list.Add(weapons.leftGun.rig);
+ }
+ if ((bool)weapons.rightGun)
+ {
+ list.Add(weapons.rightGun.rig);
+ }
+ }
+ return list.ToArray();
+ }
+}
diff --git a/_ActiveRagdoll/RotationHandler.cs b/_ActiveRagdoll/RotationHandler.cs
new file mode 100644
index 0000000..ee33545
--- /dev/null
+++ b/_ActiveRagdoll/RotationHandler.cs
@@ -0,0 +1,73 @@
+using UnityEngine;
+
+public class RotationHandler : MonoBehaviour
+{
+ private Transform rotationTarget;
+
+ private Rigidbody hip;
+
+ private Rigidbody torso;
+
+ private Rigidbody head;
+
+ public float rotationTorque;
+
+ public float clamp;
+
+ private InputHandler input;
+
+ private PlayerDeath death;
+
+ [HideInInspector]
+ public float hipCorrectionAmount;
+
+ public bool useHip = true;
+
+ public bool useTorso = true;
+
+ public bool useHead = true;
+
+ private void Start()
+ {
+ death = GetComponent<PlayerDeath>();
+ rotationTarget = GetComponentInChildren<RotationTarget>().transform;
+ hip = GetComponentInChildren<Hip>().GetComponent<Rigidbody>();
+ torso = GetComponentInChildren<Torso>().GetComponent<Rigidbody>();
+ head = GetComponentInChildren<Head>().GetComponent<Rigidbody>();
+ input = GetComponent<InputHandler>();
+ }
+
+ private void FixedUpdate()
+ {
+ if (!death.dead)
+ {
+ float num = head.transform.InverseTransformPoint(rotationTarget.position).x;
+ float num2 = torso.transform.InverseTransformPoint(rotationTarget.position).x;
+ hipCorrectionAmount = hip.transform.InverseTransformPoint(hip.transform.position + input.lastInputDirection * 10f).x;
+ float muscleFunction = death.muscleFunction;
+ float num3 = 0.3f;
+ if (input.inputMovementDirection.magnitude > 0.1f)
+ {
+ num3 = 1f;
+ }
+ if (clamp != 0f)
+ {
+ hipCorrectionAmount = Mathf.Clamp(hipCorrectionAmount, 0f - clamp, clamp);
+ num = Mathf.Clamp(num, 0f - clamp, clamp);
+ num2 = Mathf.Clamp(num2, 0f - clamp, clamp);
+ }
+ if (useHip)
+ {
+ hip.AddTorque(Vector3.up * muscleFunction * rotationTorque * num3 * hipCorrectionAmount, ForceMode.Acceleration);
+ }
+ if (useTorso)
+ {
+ torso.AddTorque(Vector3.up * muscleFunction * rotationTorque * num2, ForceMode.Acceleration);
+ }
+ if (useHead)
+ {
+ head.AddTorque(Vector3.up * muscleFunction * rotationTorque * num, ForceMode.Acceleration);
+ }
+ }
+ }
+}
diff --git a/_ActiveRagdoll/SetAnimationByInput.cs b/_ActiveRagdoll/SetAnimationByInput.cs
new file mode 100644
index 0000000..cc50e5a
--- /dev/null
+++ b/_ActiveRagdoll/SetAnimationByInput.cs
@@ -0,0 +1,40 @@
+using UnityEngine;
+
+public class SetAnimationByInput : MonoBehaviour
+{
+ private InputHandler input;
+
+ private AnimationHandler anim;
+
+ private StandingDataHandler standingData;
+
+ private void Start()
+ {
+ anim = GetComponent<AnimationHandler>();
+ input = GetComponent<InputHandler>();
+ standingData = GetComponent<StandingDataHandler>();
+ }
+
+ private void Update()
+ {
+ if ((double)standingData.sinceGrounded > 0.2)
+ {
+ anim.animationState = 3;
+ }
+ else if (input.inputMovementDirection.magnitude > 0.1f)
+ {
+ if (input.isSpringting)
+ {
+ anim.animationState = 1;
+ }
+ else
+ {
+ anim.animationState = 2;
+ }
+ }
+ else
+ {
+ anim.animationState = 0;
+ }
+ }
+}
diff --git a/_ActiveRagdoll/SetAnimationByVelocity.cs b/_ActiveRagdoll/SetAnimationByVelocity.cs
new file mode 100644
index 0000000..c737363
--- /dev/null
+++ b/_ActiveRagdoll/SetAnimationByVelocity.cs
@@ -0,0 +1,12 @@
+using UnityEngine;
+
+public class SetAnimationByVelocity : MonoBehaviour
+{
+ private void Start()
+ {
+ }
+
+ private void Update()
+ {
+ }
+}
diff --git a/_ActiveRagdoll/SetRigidbodySettings.cs b/_ActiveRagdoll/SetRigidbodySettings.cs
new file mode 100644
index 0000000..2521b75
--- /dev/null
+++ b/_ActiveRagdoll/SetRigidbodySettings.cs
@@ -0,0 +1,20 @@
+using UnityEngine;
+
+public class SetRigidbodySettings : MonoBehaviour
+{
+ public float maxAngular;
+
+ private void Start()
+ {
+ Rigidbody[] componentsInChildren = GetComponentsInChildren<Rigidbody>();
+ foreach (Rigidbody rigidbody in componentsInChildren)
+ {
+ rigidbody.maxAngularVelocity = maxAngular;
+ rigidbody.maxDepenetrationVelocity = 10000f;
+ }
+ }
+
+ private void Update()
+ {
+ }
+}
diff --git a/_ActiveRagdoll/Standing.cs b/_ActiveRagdoll/Standing.cs
new file mode 100644
index 0000000..6162215
--- /dev/null
+++ b/_ActiveRagdoll/Standing.cs
@@ -0,0 +1,55 @@
+using UnityEngine;
+
+public class Standing : MonoBehaviour
+{
+ public RigidbodyMovment[] rigsToLift;
+
+ public AnimationCurve[] animationLiftCurves;
+
+ private StandingDataHandler standingData;
+
+ private AnimationHandler animationHandler;
+
+ public float offset;
+
+ private PlayerDeath death;
+
+ private Strength str;
+
+ private float muscleMultiplier = 1f;
+
+ private float legAngleMultiplier;
+
+ private MovementDataHandler moveData;
+
+ private void Start()
+ {
+ death = GetComponent<PlayerDeath>();
+ str = GetComponent<Strength>();
+ standingData = GetComponent<StandingDataHandler>();
+ moveData = GetComponent<MovementDataHandler>();
+ animationHandler = GetComponent<AnimationHandler>();
+ }
+
+ private void FixedUpdate()
+ {
+ if (!death.dead)
+ {
+ muscleMultiplier = str.strength;
+ if (standingData.isGrounded)
+ {
+ Stand(animationLiftCurves[animationHandler.animationState]);
+ }
+ }
+ }
+
+ private void Stand(AnimationCurve curve)
+ {
+ legAngleMultiplier = 1f;
+ RigidbodyMovment[] array = rigsToLift;
+ foreach (RigidbodyMovment rigidbodyMovment in array)
+ {
+ rigidbodyMovment.rig.AddForce(Vector3.up * muscleMultiplier * rigidbodyMovment.force * legAngleMultiplier * curve.Evaluate(standingData.distanceToGround + offset + moveData.slopeVelocityStrenght * -0.2f), ForceMode.Acceleration);
+ }
+ }
+}
diff --git a/_ActiveRagdoll/StandingDataHandler.cs b/_ActiveRagdoll/StandingDataHandler.cs
new file mode 100644
index 0000000..10a1473
--- /dev/null
+++ b/_ActiveRagdoll/StandingDataHandler.cs
@@ -0,0 +1,69 @@
+using UnityEngine;
+
+public class StandingDataHandler : MonoBehaviour
+{
+ public Rigidbody mainRig;
+
+ public float sinceGrounded;
+
+ public float sinceLanded;
+
+ public bool isGrounded;
+
+ public float distanceToGround = 1f;
+
+ private bool hasRecievedTouchedGround;
+
+ private MovementDataHandler moveMentData;
+
+ private PlayerKnockback knockback;
+
+ private WobbleShake wobbleShake;
+
+ private void Start()
+ {
+ wobbleShake = GetComponentInChildren<WobbleShake>();
+ knockback = GetComponent<PlayerKnockback>();
+ }
+
+ private void FixedUpdate()
+ {
+ sinceGrounded += Time.fixedDeltaTime;
+ sinceLanded += Time.fixedDeltaTime;
+ moveMentData = GetComponent<MovementDataHandler>();
+ if ((double)sinceGrounded > 0.1)
+ {
+ isGrounded = false;
+ }
+ }
+
+ private void LateUpdate()
+ {
+ hasRecievedTouchedGround = false;
+ }
+
+ public void TouchGround(float distance, Vector3 normal)
+ {
+ if (sinceGrounded > 0.5f && (bool)wobbleShake)
+ {
+ wobbleShake.AddShake(-Vector3.up * 5f * Mathf.Pow(sinceGrounded, 1.5f), 0.8f);
+ }
+ if (sinceGrounded > 0.5f)
+ {
+ Land(sinceGrounded);
+ }
+ sinceGrounded = 0f;
+ isGrounded = true;
+ if (distance > distanceToGround || !hasRecievedTouchedGround)
+ {
+ distanceToGround = distance;
+ }
+ hasRecievedTouchedGround = true;
+ moveMentData.SetSlope(normal);
+ }
+
+ private void Land(float landForce)
+ {
+ sinceLanded = 0f;
+ }
+}
diff --git a/_ActiveRagdoll/StartRotation.cs b/_ActiveRagdoll/StartRotation.cs
new file mode 100644
index 0000000..4ae91b2
--- /dev/null
+++ b/_ActiveRagdoll/StartRotation.cs
@@ -0,0 +1,18 @@
+using UnityEngine;
+
+public class StartRotation : MonoBehaviour
+{
+ public Quaternion startRotation;
+
+ public Quaternion startRotationLocal;
+
+ private void Start()
+ {
+ startRotation = base.transform.rotation;
+ startRotationLocal = base.transform.localRotation;
+ }
+
+ private void Update()
+ {
+ }
+}
diff --git a/_ActiveRagdoll/StayInPlace.cs b/_ActiveRagdoll/StayInPlace.cs
new file mode 100644
index 0000000..d10ebba
--- /dev/null
+++ b/_ActiveRagdoll/StayInPlace.cs
@@ -0,0 +1,50 @@
+using UnityEngine;
+
+public class StayInPlace : MonoBehaviour
+{
+ private InputHandler input;
+
+ public Rigidbody rig;
+
+ public float force;
+
+ private Vector3 stopPosition;
+
+ private bool isBroken;
+
+ private PlayerDeath death;
+
+ private Strength str;
+
+ private float strength = 1f;
+
+ private void Start()
+ {
+ str = GetComponent<Strength>();
+ input = GetComponent<InputHandler>();
+ death = GetComponent<PlayerDeath>();
+ stopPosition = rig.position;
+ }
+
+ private void FixedUpdate()
+ {
+ if (death.dead)
+ {
+ return;
+ }
+ strength = str.strength;
+ if (input.inputMovementDirection.magnitude > 0.1f)
+ {
+ stopPosition = rig.position + rig.velocity * 0.25f;
+ isBroken = false;
+ }
+ else if (!isBroken)
+ {
+ if (Vector3.Distance(stopPosition, rig.position) > 1f)
+ {
+ isBroken = true;
+ }
+ rig.AddForce((stopPosition - rig.position) * force * strength, ForceMode.Acceleration);
+ }
+ }
+}
diff --git a/_ActiveRagdoll/StepHandler.cs b/_ActiveRagdoll/StepHandler.cs
new file mode 100644
index 0000000..fd8110b
--- /dev/null
+++ b/_ActiveRagdoll/StepHandler.cs
@@ -0,0 +1,53 @@
+using UnityEngine;
+
+public class StepHandler : MonoBehaviour
+{
+ public float staticCounter;
+
+ public Step[] steps;
+
+ public bool isLeft;
+
+ private float counter;
+
+ private Transform leftLeg;
+
+ private Transform rightLeg;
+
+ private AnimationHandler animationHandler;
+
+ private Transform hip;
+
+ private void Start()
+ {
+ if (staticCounter == 0f)
+ {
+ leftLeg = GetComponentInChildren<LegLeft>().transform;
+ rightLeg = GetComponentInChildren<LegRight>().transform;
+ animationHandler = GetComponent<AnimationHandler>();
+ hip = GetComponentInChildren<Hip>().transform;
+ }
+ }
+
+ private void Update()
+ {
+ counter += Time.deltaTime;
+ if (staticCounter != 0f)
+ {
+ if (counter > staticCounter)
+ {
+ Switch();
+ }
+ }
+ else if (counter > steps[animationHandler.animationState].minTime && (steps[animationHandler.animationState].minAngle == 0f || steps[animationHandler.animationState].minAngle < Vector3.Angle(leftLeg.forward, rightLeg.forward)) && isLeft == hip.InverseTransformPoint(leftLeg.position + leftLeg.forward).z > hip.InverseTransformPoint(rightLeg.position + rightLeg.forward).z)
+ {
+ Switch();
+ }
+ }
+
+ private void Switch()
+ {
+ isLeft = !isLeft;
+ counter = 0f;
+ }
+}
diff --git a/_ActiveRagdoll/Strength.cs b/_ActiveRagdoll/Strength.cs
new file mode 100644
index 0000000..f458b21
--- /dev/null
+++ b/_ActiveRagdoll/Strength.cs
@@ -0,0 +1,21 @@
+using UnityEngine;
+
+public class Strength : MonoBehaviour
+{
+ public float strength = 1f;
+
+ private PlayerDeath death;
+
+ private RagdollHandler ragdoll;
+
+ private void Start()
+ {
+ ragdoll = GetComponent<RagdollHandler>();
+ death = GetComponent<PlayerDeath>();
+ }
+
+ private void Update()
+ {
+ strength = ragdoll.ragdollValue * death.muscleFunction;
+ }
+}
diff --git a/_ActiveRagdoll/WeaponHandler.cs b/_ActiveRagdoll/WeaponHandler.cs
new file mode 100644
index 0000000..7b3d80f
--- /dev/null
+++ b/_ActiveRagdoll/WeaponHandler.cs
@@ -0,0 +1,75 @@
+using UnityEngine;
+
+public class WeaponHandler : MonoBehaviour
+{
+ [HideInInspector]
+ public Gun leftGun;
+
+ [HideInInspector]
+ public Gun rightGun;
+
+ [HideInInspector]
+ public Transform gunADS;
+
+ [HideInInspector]
+ public float ADSFOV;
+
+ public bool isDualWeilding;
+
+ private void Start()
+ {
+ }
+
+ private void Update()
+ {
+ }
+
+ public void SetWeapon(Weapon w, bool mainHand)
+ {
+ }
+
+ public void SetGun(Gun g, bool mainHand)
+ {
+ if (mainHand)
+ {
+ rightGun = g;
+ gunADS = g.GetComponentInChildren<ADS>().transform;
+ ADSFOV = g.ADSFOV;
+ }
+ else
+ {
+ leftGun = g;
+ }
+ if ((bool)leftGun && (bool)rightGun)
+ {
+ isDualWeilding = true;
+ }
+ }
+
+ public void HoldAttack(bool shootWithRightGun, bool ADS)
+ {
+ if (shootWithRightGun)
+ {
+ if (rightGun.auto)
+ {
+ rightGun.Shoot(base.transform.root, ADS);
+ }
+ }
+ else if (leftGun.auto)
+ {
+ leftGun.Shoot(base.transform.root, ADS);
+ }
+ }
+
+ public void PressAttack(bool shootWithRightGun, bool ADS)
+ {
+ if (shootWithRightGun)
+ {
+ rightGun.Shoot(base.transform.root, ADS);
+ }
+ else
+ {
+ leftGun.Shoot(base.transform.root, ADS);
+ }
+ }
+}