Пример #1
0
    private void Awake()
    {
        photonView    = GetComponent <PhotonView>();
        voiceRecorder = GetComponent <PhotonVoiceRecorder>();

        m_RigidBody = GetComponent <Rigidbody>();
        m_Capsule   = GetComponent <CapsuleCollider>();

        if (photonView != null)
        {
            if (!photonView.isMine)
            {
                return;
            }
        }

        if (cam == null)
        {
            cam = Camera.main;
            HeadBob headBob = cam.GetComponent <HeadBob>();
            headBob.Init(cam, cameraPos, this, photonView);
        }

        mouseLook.Init(transform, cam.transform);
    }
        private void NoRecoil()
        {
            if (!CVars.Misc.NoRecoil)
            {
                return;
            }
            HumanController localController     = HackLocal.LocalController;
            InventoryItem   currentEquippedItem = HackLocal.GetCurrentEquippedItem(localController);

            if (currentEquippedItem != null && !(currentEquippedItem is MeleeWeaponItem <MeleeWeaponDataBlock>))
            {
                BulletWeaponItem <BulletWeaponDataBlock> bulletWeaponItem = currentEquippedItem as BulletWeaponItem <BulletWeaponDataBlock>;
                if (bulletWeaponItem != null)
                {
                    bulletWeaponItem.datablock.bulletRange    = 300f;
                    bulletWeaponItem.datablock.recoilPitchMin = 0f;
                    bulletWeaponItem.datablock.recoilPitchMax = 0f;
                    bulletWeaponItem.datablock.recoilYawMin   = 0f;
                    bulletWeaponItem.datablock.recoilYawMax   = 0f;
                    bulletWeaponItem.datablock.aimSway        = 0f;
                    bulletWeaponItem.datablock.aimSwaySpeed   = 0f;
                }
            }
            CameraMount componentInChildren = localController.GetComponentInChildren <CameraMount>();

            if (componentInChildren != null)
            {
                HeadBob component = componentInChildren.GetComponent <HeadBob>();
                if (component != null)
                {
                    component.aimRotationScalar       = 0f;
                    component.viewModelRotationScalar = 0f;
                }
            }
        }
Пример #3
0
 // -- lifecycle --
 protected void Awake()
 {
     mAnimator  = GetComponent <Animator>();
     mCharacter = GetComponent <CharacterController>();
     mHeadBob   = GetComponentInChildren <HeadBob>();
     mControls  = GetComponentsInChildren <MouseLook>();
 }
Пример #4
0
 public void Hurt(float percent, GameObject attacker)
 {
     if (percent >= 0.05f)
     {
         this.lastTakeDamageTime = Time.time;
         if (CameraMount.current != null)
         {
             HeadBob component = CameraMount.current.GetComponent <HeadBob>();
             if (component == null)
             {
                 Debug.Log("no camera headbob");
             }
             if (component != null)
             {
                 bool flag;
                 if (attacker != null)
                 {
                     Controllable controllable = attacker.GetComponent <Controllable>();
                     flag = (controllable != null) && (controllable.npcName == "zombie");
                     if (!flag)
                     {
                         flag = attacker.GetComponent <BasicWildLifeAI>() != null;
                     }
                 }
                 else
                 {
                     flag = false;
                 }
                 component.AddEffect(!flag ? this.takeDamageBob : this.meleeBob);
             }
         }
     }
 }
Пример #5
0
    public override void Local_FireWeapon(ViewModel vm, ItemRepresentation itemRep, IBulletWeaponItem itemInstance, ref HumanController.InputSample sample)
    {
        Character character = itemInstance.character;

        if ((character != null) && (itemInstance.clipAmmo > 0))
        {
            Socket muzzle;
            Ray    eyesRay = character.eyesRay;
            int    count   = 1;
            itemInstance.Consume(ref count);
            uLink.BitStream sendStream  = new uLink.BitStream(false);
            float           bulletRange = this.GetBulletRange(itemRep);
            for (int i = 0; i < this.numPellets; i++)
            {
                bool flag;
                Ray  ray = eyesRay;
                ray.direction = (Vector3)((Quaternion.LookRotation(eyesRay.direction) * Quaternion.Euler(UnityEngine.Random.Range(-this.xSpread, this.xSpread), UnityEngine.Random.Range(-this.ySpread, this.ySpread), 0f)) * Vector3.forward);
                Component hitComponent = null;
                this.FireSingleBullet(sendStream, ray, itemRep, out hitComponent, out flag);
                this.MakeTracer(ray.origin, ray.origin + ((Vector3)(ray.direction * bulletRange)), bulletRange, hitComponent, flag);
            }
            itemRep.ActionStream(1, uLink.RPCMode.Server, sendStream);
            bool firstPerson = (bool)vm;
            if (firstPerson)
            {
                muzzle = vm.muzzle;
            }
            else
            {
                muzzle = itemRep.muzzle;
            }
            this.DoWeaponEffects(character.transform, muzzle, firstPerson, itemRep);
            if (firstPerson)
            {
                vm.PlayFireAnimation();
            }
            float num4 = 1f;
            if (sample.aim)
            {
                num4 -= base.aimingRecoilSubtract;
            }
            else if (sample.crouch)
            {
                num4 -= base.crouchRecoilSubtract;
            }
            float            pitch            = UnityEngine.Random.Range(base.recoilPitchMin, base.recoilPitchMax) * num4;
            float            yaw              = UnityEngine.Random.Range(base.recoilYawMin, base.recoilYawMax) * num4;
            RecoilSimulation recoilSimulation = character.recoilSimulation;
            if (recoilSimulation != null)
            {
                recoilSimulation.AddRecoil(base.recoilDuration, pitch, yaw);
            }
            HeadBob bob = CameraMount.current.GetComponent <HeadBob>();
            if ((bob != null) && (base.shotBob != null))
            {
                bob.AddEffect(base.shotBob);
            }
        }
    }
Пример #6
0
    /*
     *
     *  private void OnDrawGizmos()
     *  {
     *      Gizmos.color = Color.yellow;
     *      Gizmos.DrawWireSphere((transform.position + m_characterController.center) - Vector3.up * m_finalRayLength, raySphereRadius);
     *  }
     *
     */

    //#endregion

    #region IPunObservable implementation


    //public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)
    //{
    //    if (stream.IsWriting)
    //    {
    //        // We own this player: send the others our data
    //        stream.SendNext(IsFiring);
    //    }
    //    else
    //    {
    //        // Network player, receive data
    //        this.IsFiring = (bool)stream.ReceiveNext();
    //    }
    //}


    #endregion

    #region Custom Methods
    #region Initialize Methods
    protected virtual void GetComponents()
    {
        m_characterController = GetComponent <CharacterController>();
        m_cameraController    = GetComponentInChildren <CameraController>();
        m_yawTransform        = m_cameraController.transform;
        m_camTransform        = GetComponentInChildren <CinemachineVirtualCamera>().transform;
        m_headBob             = new HeadBob(headBobData, moveBackwardsSpeedPercent, moveSideSpeedPercent);
    }
Пример #7
0
 private void AddMovementComponents(VRLocomotionRig a_vrLR)
 {
     a_vrLR.s_head.gameObject.AddComponent <SteamVR_UpdatePoses>();
     m_headBob  = a_vrLR.s_head.gameObject.AddComponent <HeadBob>();  // Adds the HeadBob movement logic component
     m_armSwing = a_vrLR.s_head.gameObject.AddComponent <ArmSwing>(); // Adds the ArmSwing movement logic component
     m_pulley   = a_vrLR.s_head.gameObject.AddComponent <Pulley>();   // Adds the Pulley movement logic component
     m_tPad     = a_vrLR.s_head.gameObject.AddComponent <Touchpad>();
     // DEVELOPER: ADD YOUR OWN CUSTOM VR MOVEMENT COMPONENT HERE!
 }
Пример #8
0
 public void FallImpact(float fallspeed)
 {
     this.legBreakSound.Play(base.transform.position, 1f, 3f, 10f);
     if (base.localControlled)
     {
         HeadBob component = CameraMount.current.GetComponent <HeadBob>();
         component.AddEffect(this.fallbob);
     }
 }
Пример #9
0
 void Awake()
 {
     story          = GameObject.FindObjectOfType <Story>();
     fpsController  = GetComponentInChildren <RigidbodyFirstPersonController>();
     headBob        = GetComponentInChildren <HeadBob>();
     health         = GetComponent <Health>();
     playerBody     = GetComponent <Rigidbody>();
     playerCollider = GetComponent <Collider>();
     soundPlayer    = GetComponentInChildren <AudioSource>();
 }
Пример #10
0
    private void Start()
    {
        walkController    = GetComponent <RigidbodyFirstPersonController>();
        headbobController = GetComponentInChildren <HeadBob>();
        flyController     = GetComponent <FlyCamera>();
        playerRigidbody   = GetComponent <Rigidbody>();

        //FreezePlayer();
        SetPlayerMode(false);
    }
Пример #11
0
        void Start()
        {
            _rb = GetComponent <Rigidbody>();
            _ih = GetComponent <InputHandler>();
            _pr = GetComponentInChildren <PlayerRotation>();
            _hb = GetComponentInChildren <HeadBob>();

            // TODO: Mover isso para outro lugar
            Cursor.lockState = CursorLockMode.Locked;
        }
Пример #12
0
 void Start()
 {
     controller    = GetComponent <CharacterController>();
     myTransform   = transform;
     speed         = walkSpeed;
     rayDistance   = controller.height * .5f + controller.radius;
     slideLimit    = controller.slopeLimit - .1f;
     jumpTimer     = antiBunnyHopFactor;
     walking       = false;
     headBobScript = fpCamera.gameObject.GetComponent <HeadBob>();
 }
Пример #13
0
 private void OnCollisionExit(Collision collision)
 {
     if (collision.rigidbody.tag == "Player")
     {
         HeadBob hBob = collision.rigidbody.GetComponentInChildren <HeadBob> ();
         if (hBob)
         {
             hBob.motionBob.VerticalBobRange = storedBobRange;
         }
     }
 }
Пример #14
0
    private static void DrawForceAxes(Vector3 force, Vector3 radii, Vector3 k, float boxDim)
    {
        Color color = Gizmos.color;

        Gizmos.color = color * Color.red;
        HeadBob.DrawForceLine(Vector3.right, force, radii, k, boxDim);
        Gizmos.color = color * Color.green;
        HeadBob.DrawForceLine(Vector3.up, force, radii, k, boxDim);
        Gizmos.color = color * Color.blue;
        HeadBob.DrawForceLine(Vector3.forward, force, radii, k, boxDim);
        Gizmos.color = color;
    }
Пример #15
0
    private void OnDrawGizmosSelected()
    {
        Gizmos.matrix = ((!base.transform.parent ? base.transform : base.transform.parent)).localToWorldMatrix;
        Gizmos.DrawLine(Vector3.zero, this.offset);
        Matrix4x4 matrix4x4 = Gizmos.matrix;

        Gizmos.matrix = Gizmos.matrix * Matrix4x4.Scale(this.cfg.elipsoidRadii);
        Gizmos.DrawWireSphere(Vector3.zero, 1f);
        Gizmos.matrix = matrix4x4;
        Gizmos.color  = new Color(1f, 1f, 1f, 0.8f);
        HeadBob.DrawForceAxes(this.working.position.acceleration.f, this.cfg.elipsoidRadii, this.cfg.springConstant, 0.2f);
        Gizmos.color = Color.white;
        HeadBob.DrawForceAxes(this.working.position.acceleration.f, this.cfg.elipsoidRadii, this.cfg.maxVelocity, 0.1f);
    }
Пример #16
0
        // DEVELOPER: add a string for your zone tag name! dont forget to create the tag in unity and apply it
        //private const string DevCollisionTag      = "DeveloperZone";

        #endregion

        #region Unity Methods

        void Awake()
        {
            m_locoRig = GetComponent <VRLocomotionRig>();

            source = GetComponent <AudioSource>();

            try {
                m_hbMovement = m_locoRig.s_head.GetComponent <HeadBob>();
                m_asMovement = m_locoRig.s_head.GetComponent <ArmSwing>();
                m_pMovement  = m_locoRig.s_head.GetComponent <Pulley>();
            } catch {
                Debug.LogError("there are no movement components attached to your VR rig! please ensure you did the setup correctly!");
            }
            AutoDetectCurrentMovement();
        }
Пример #17
0
    // Start is called before the first frame update
    void Start()
    {
        carScript       = carScript.GetComponent <CarController>();
        boosterScript   = boosterScript.GetComponent <ParticleSystemBehavior>();
        cameraScript    = cameraScript.GetComponent <cameraController>();
        playerScript    = playerScript.GetComponent <RigidbodyFirstPersonController>();
        playerCamScript = playerCamScript.GetComponent <HeadBob>();


        playerCamScript.enabled = true;
        carScript.enabled       = false;
        boosterScript.enabled   = false;
        boosterScript2.enabled  = false;
        cameraScript.enabled    = false;
        playerScript.enabled    = true;
        carCam2.enabled         = false;
        Player.SetActive(true);
    }
    void Start()
    {
        playerAnim    = GetComponent <Animator>();
        headBobScript = transform.GetChild(0).gameObject.GetComponent <HeadBob>();

        if (OpeningManager.OpeningIndex == 1)
        {
            StartCoroutine(OpeningEffect());
        }
        else if (OpeningManager.OpeningIndex == 2)
        {
            transform.position = path1.path.GetPoint(58);
            opening_2.Play();
        }
        else if (OpeningManager.OpeningIndex == 3)
        {
            transform.position = path1.path.GetPoint(58);
            opening_3.Play();
        }
    }
Пример #19
0
    //Get components
    protected override void Start()
    {
        base.Start();

        //These will always work
        playerController = GetComponent <PlayerController>();
        playerInput      = GetComponent <PlayerInput>();

        //May possibly evaluate to null
        gunManager = GetComponent <GunManager>();
        mouseLook  = GetComponentInChildren <MouseLook>();
        headBobber = GetComponentInChildren <HeadBob>();

        //Attach the gun to the hand
        if (gunManager != null)
        {
            gunManager.EquipWeapon(startingWeapon);
        }

        normalSpeed  = playerController.moveSpeed;
        walkingSpeed = normalSpeed * 0.1f;
    }
Пример #20
0
    public void Hurt(float percent, GameObject attacker)
    {
        bool component;

        if (percent < 0.05f)
        {
            return;
        }
        this.lastTakeDamageTime = Time.time;
        if (CameraMount.current == null)
        {
            return;
        }
        HeadBob headBob = CameraMount.current.GetComponent <HeadBob>();

        if (headBob == null)
        {
            Debug.Log("no camera headbob");
        }
        if (headBob)
        {
            if (!attacker)
            {
                component = false;
            }
            else
            {
                Controllable controllable = attacker.GetComponent <Controllable>();
                component = (!controllable ? false : controllable.npcName == "zombie");
                if (!component)
                {
                    component = attacker.GetComponent <BasicWildLifeAI>() != null;
                }
            }
            headBob.AddEffect((!component ? this.takeDamageBob : this.meleeBob));
        }
    }
Пример #21
0
    private void SetLocalOnlyComponentsEnabled(bool enable)
    {
        CCMotor component = base.GetComponent <CCMotor>();

        if (component != null)
        {
            component.enabled = enable;
            CharacterController collider = base.collider as CharacterController;
            if (collider != null)
            {
                collider.enabled = enable;
            }
        }
        CameraMount componentInChildren = base.GetComponentInChildren <CameraMount>();

        if (componentInChildren != null)
        {
            componentInChildren.open = enable;
            HeadBob bob = componentInChildren.GetComponent <HeadBob>();
            if (bob != null)
            {
                bob.enabled = enable;
            }
            LazyCam cam = componentInChildren.GetComponent <LazyCam>();
            if (cam != null)
            {
                cam.enabled = enable;
            }
        }
        LocalDamageDisplay display = base.GetComponent <LocalDamageDisplay>();

        if (display != null)
        {
            display.enabled = enable;
        }
    }
Пример #22
0
    private void SetLocalOnlyComponentsEnabled(bool enable)
    {
        CCMotor component = base.GetComponent <CCMotor>();

        if (component)
        {
            component.enabled = enable;
            CharacterController characterController = base.collider as CharacterController;
            if (characterController)
            {
                characterController.enabled = enable;
            }
        }
        CameraMount componentInChildren = base.GetComponentInChildren <CameraMount>();

        if (componentInChildren)
        {
            componentInChildren.open = enable;
            HeadBob headBob = componentInChildren.GetComponent <HeadBob>();
            if (headBob)
            {
                headBob.enabled = enable;
            }
            LazyCam lazyCam = componentInChildren.GetComponent <LazyCam>();
            if (lazyCam)
            {
                lazyCam.enabled = enable;
            }
        }
        LocalDamageDisplay localDamageDisplay = base.GetComponent <LocalDamageDisplay>();

        if (localDamageDisplay)
        {
            localDamageDisplay.enabled = enable;
        }
    }
Пример #23
0
 void Awake()
 {
     rigidbody    = GetComponent <Rigidbody> ();
     rigidbodyFPC = GetComponent <RigidbodyFirstPersonController> ();
     headBob      = GetComponentInChildren <HeadBob> ();
 }
Пример #24
0
 public double AddDifference(ref HeadBob.VectorStamp previous, ref Vector3G difference)
 {
     if (!previous.valid || previous.timeStamp == this.timeStamp)
     {
         return 0;
     }
     double num = 1 / (double)(this.timeStamp - previous.timeStamp);
     difference.x = difference.x + num * (this.vector.x - previous.vector.x);
     difference.y = difference.y + num * (this.vector.y - previous.vector.y);
     difference.z = difference.z + num * (this.vector.z - previous.vector.z);
     return 1;
 }
Пример #25
0
        // Token: 0x06000001 RID: 1 RVA: 0x00002050 File Offset: 0x00000250
        public void OnGUI()
        {
            bool flag = !PlayerClient.GetLocalPlayer() || !PlayerClient.GetLocalPlayer().controllable;

            if (flag)
            {
                ZoomGUIRustNoWipe.onlytimemsg    = true;
                ZoomGUIRustNoWipe.levelzoom      = 60f;
                ZoomGUIRustNoWipe.counterseconds = 10f;
                Zoom.On = false;
            }
            else
            {
                bool flag2 = !Zoom.On && ZoomGUIRustNoWipe.counterseconds >= 0f;
                if (flag2)
                {
                    GUI.DrawTexture(new Rect(600f, 200f, 116f, 54f), ZoomGUIRustNoWipe.Messagy, ScaleMode.StretchToFill);
                    ZoomGUIRustNoWipe.counterseconds -= Time.deltaTime;
                }
                else
                {
                    bool flag3 = !Zoom.On && ZoomGUIRustNoWipe.onlytimemsg;
                    if (flag3)
                    {
                        ZoomGUIRustNoWipe.onlytimemsg = false;
                    }
                    else
                    {
                        bool flag4 = PlayerClient.GetLocalPlayer() || (PlayerClient.GetLocalPlayer().controllable&& Zoom.On);
                        if (flag4)
                        {
                            ZoomGUIRustNoWipe.mouse0 = false;
                            ZoomGUIRustNoWipe.mouse1 = false;
                            bool key = Input.GetKey(KeyCode.Mouse0);
                            if (key)
                            {
                                ZoomGUIRustNoWipe.mouse1 = true;
                            }
                            bool key2 = Input.GetKey(KeyCode.Mouse1);
                            if (key2)
                            {
                                ZoomGUIRustNoWipe.mouse0 = true;
                            }
                            bool keyUp = Input.GetKeyUp(KeyCode.Mouse0);
                            if (keyUp)
                            {
                                ZoomGUIRustNoWipe.mouse1 = false;
                            }
                            bool keyUp2 = Input.GetKeyUp(KeyCode.Mouse1);
                            if (keyUp2)
                            {
                                ZoomGUIRustNoWipe.mouse0 = false;
                            }
                        }
                        bool flag5 = ZoomGUIRustNoWipe.mouse1 && !ZoomGUIRustNoWipe.mouse0 && Zoom.On;
                        if (flag5)
                        {
                            Inventory component = PlayerClient.GetLocalPlayer().controllable.GetComponent <Inventory>();
                            this.ClearWeapon(component);
                            bool flag6 = ZoomGUIRustNoWipe.levelzoom > 60f;
                            if (flag6)
                            {
                                ZoomGUIRustNoWipe.levelzoom = 60f;
                            }
                            bool flag7 = ZoomGUIRustNoWipe.levelzoom < 0f;
                            if (flag7)
                            {
                                ZoomGUIRustNoWipe.levelzoom = 0f;
                            }
                            bool flag8 = ZoomGUIRustNoWipe.levelzoom >= 20f;
                            if (flag8)
                            {
                                ZoomGUIRustNoWipe.levelzoom = ZoomGUIRustNoWipe.levelzoom - Time.deltaTime - 0.3f;
                            }
                            bool flag9 = ZoomGUIRustNoWipe.levelzoom < 20f;
                            if (flag9)
                            {
                                ZoomGUIRustNoWipe.levelzoom = ZoomGUIRustNoWipe.levelzoom - Time.deltaTime - 0.05f;
                            }
                            bool flag10 = ZoomGUIRustNoWipe.levelzoom > 0f;
                            if (flag10)
                            {
                                HumanController component2          = PlayerClient.GetLocalPlayer().controllable.GetComponent <HumanController>();
                                CameraMount     componentInChildren = component2.GetComponentInChildren <CameraMount>();
                                bool            flag11 = componentInChildren != null;
                                if (flag11)
                                {
                                    HeadBob component3 = componentInChildren.GetComponent <HeadBob>();
                                    bool    flag12     = component3 != null;
                                    if (flag12)
                                    {
                                        CameraFX mainCameraFX = CameraFX.mainCameraFX;
                                        bool     flag13       = mainCameraFX != null;
                                        if (flag13)
                                        {
                                            mainCameraFX.SetFieldOfView(ZoomGUIRustNoWipe.levelzoom, 1f);
                                        }
                                    }
                                }
                            }
                        }
                        bool flag14 = ZoomGUIRustNoWipe.mouse0 && !ZoomGUIRustNoWipe.mouse1 && Zoom.On;
                        if (flag14)
                        {
                            Inventory component4 = PlayerClient.GetLocalPlayer().controllable.GetComponent <Inventory>();
                            this.ClearWeapon(component4);
                            bool flag15 = ZoomGUIRustNoWipe.levelzoom > 60f;
                            if (flag15)
                            {
                                ZoomGUIRustNoWipe.levelzoom = 60f;
                            }
                            bool flag16 = ZoomGUIRustNoWipe.levelzoom < 0f;
                            if (flag16)
                            {
                                ZoomGUIRustNoWipe.levelzoom = 0f;
                            }
                            bool flag17 = ZoomGUIRustNoWipe.levelzoom >= 20f;
                            if (flag17)
                            {
                                ZoomGUIRustNoWipe.levelzoom = ZoomGUIRustNoWipe.levelzoom + Time.deltaTime + 0.3f;
                            }
                            bool flag18 = ZoomGUIRustNoWipe.levelzoom < 20f;
                            if (flag18)
                            {
                                ZoomGUIRustNoWipe.levelzoom = ZoomGUIRustNoWipe.levelzoom + Time.deltaTime + 0.05f;
                            }
                            bool flag19 = ZoomGUIRustNoWipe.levelzoom > 0f;
                            if (flag19)
                            {
                                HumanController component5           = PlayerClient.GetLocalPlayer().controllable.GetComponent <HumanController>();
                                CameraMount     componentInChildren2 = component5.GetComponentInChildren <CameraMount>();
                                bool            flag20 = componentInChildren2 != null;
                                if (flag20)
                                {
                                    HeadBob component6 = componentInChildren2.GetComponent <HeadBob>();
                                    bool    flag21     = component6 != null;
                                    if (flag21)
                                    {
                                        CameraFX mainCameraFX2 = CameraFX.mainCameraFX;
                                        bool     flag22        = mainCameraFX2 != null;
                                        if (flag22)
                                        {
                                            mainCameraFX2.SetFieldOfView(ZoomGUIRustNoWipe.levelzoom, 1f);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
Пример #26
0
    public virtual void Local_FireWeapon(ViewModel vm, ItemRepresentation itemRep, IBulletWeaponItem itemInstance, ref HumanController.InputSample sample)
    {
        Component   component;
        Vector3     point;
        RaycastHit2 hit;
        IDMain      main;
        bool        flag4;
        Socket      muzzle;
        bool        flag5;
        Character   shooterOrNull = itemInstance.character;

        if (shooterOrNull == null)
        {
            return;
        }
        if (itemInstance.clipAmmo <= 0)
        {
            return;
        }
        Ray         eyesRay        = shooterOrNull.eyesRay;
        NetEntityID unassigned     = NetEntityID.unassigned;
        bool        hitNetworkView = false;
        int         count          = 1;

        itemInstance.Consume(ref count);
        bool       didHit = Physics2.Raycast2(eyesRay, out hit, this.GetBulletRange(itemRep), 0x183e1411);
        TakeDamage damage = null;

        if (!didHit)
        {
            main      = null;
            point     = eyesRay.GetPoint(1000f);
            component = null;
            goto Label_019E;
        }
        point = hit.point;
        IDBase id = hit.id;

        component = (hit.remoteBodyPart == null) ? ((Component)hit.collider) : ((Component)hit.remoteBodyPart);
        main      = (id == null) ? null : id.idMain;
        if (main == null)
        {
            goto Label_019E;
        }
        unassigned = NetEntityID.Get((MonoBehaviour)main);
        if (unassigned.isUnassigned)
        {
            goto Label_019E;
        }
        hitNetworkView = true;
        damage         = main.GetComponent <TakeDamage>();
        if ((damage != null) && damage.ShouldPlayHitNotification())
        {
            this.PlayHitNotification(point, shooterOrNull);
        }
        bool flag3 = false;

        if (hit.remoteBodyPart != null)
        {
            BodyPart bodyPart = hit.remoteBodyPart.bodyPart;
            switch (bodyPart)
            {
            case BodyPart.Brain:
            case BodyPart.L_Eye:
            case BodyPart.R_Eye:
                break;

            default:
                switch (bodyPart)
                {
                case BodyPart.Head:
                case BodyPart.Jaw:
                    break;

                case BodyPart.Scalp:
                case BodyPart.Nostrils:
                    goto Label_016C;

                default:
                    goto Label_016C;
                }
                break;
            }
            flag3 = true;
        }
        goto Label_0174;
Label_016C:
        flag3 = false;
Label_0174:
        if (flag3)
        {
            this.headshotSound.Play();
        }
Label_019E:
        flag4 = didHit && ((!hit.isHitboxHit || hit.bodyPart.IsDefined()) || (damage != null));
        if (vm != null)
        {
            Socket.Slot slot = vm.socketMap["muzzle"];
            muzzle = slot.socket;
            flag5  = true;
        }
        else
        {
            muzzle = itemRep.muzzle;
            flag5  = false;
        }
        Vector3 position = muzzle.position;

        this.DoWeaponEffects(shooterOrNull.transform, position, point, muzzle, flag5, component, flag4, itemRep);
        if (flag5)
        {
            vm.PlayFireAnimation();
        }
        float num2 = 1f;

        if (sample.aim && sample.crouch)
        {
            num2 -= this.aimingRecoilSubtract + (this.crouchRecoilSubtract * 0.5f);
        }
        else if (sample.aim)
        {
            num2 -= this.aimingRecoilSubtract;
        }
        else if (sample.crouch)
        {
            num2 -= this.crouchRecoilSubtract;
        }
        num2 = Mathf.Clamp01(num2);
        float pitch = Random.Range(this.recoilPitchMin, this.recoilPitchMax) * num2;
        float yaw   = Random.Range(this.recoilYawMin, this.recoilYawMax) * num2;

        if (weaponRecoil && (shooterOrNull.recoilSimulation != null))
        {
            shooterOrNull.recoilSimulation.AddRecoil(this.recoilDuration, pitch, yaw);
        }
        HeadBob bob = CameraMount.current.GetComponent <HeadBob>();

        if (((bob != null) && (this.shotBob != null)) && headRecoil)
        {
            bob.AddEffect(this.shotBob);
        }
        BitStream sendStream = new BitStream(false);

        this.WriteHitInfo(sendStream, ref eyesRay, didHit, ref hit, hitNetworkView, unassigned);
        itemRep.ActionStream(1, RPCMode.Server, sendStream);
    }
Пример #27
0
 void Start()
 {
     headBob = GetComponentInChildren<HeadBob>();
     fpd = GetComponent<FirstPersonDrifter>();
 }
Пример #28
0
 void Start()
 {
     headbob = Camera.main.GetComponent <HeadBob>();
 }
Пример #29
0
 public void CopyTo(ref HeadBob.Weight other)
 {
     if (other.additionalPositions != this.additionalPositions && this.additionalPositions != null)
     {
         Array.Copy(this.additionalPositions, other.additionalPositions, (int)this.additionalPositions.Length);
     }
     other.rotation = this.rotation;
     other.position = this.position;
     if (other.stack != null && other.stack.IsForkOf(this.stack))
     {
         other.stack.Join();
     }
 }
	void Awake()
	{
		rigidbody = GetComponent<Rigidbody> ();
		rigidbodyFPC = GetComponent<RigidbodyFirstPersonController> ();
		headBob = GetComponentInChildren<HeadBob> ();
	}
Пример #31
0
    public override void Local_FireWeapon(ViewModel vm, ItemRepresentation itemRep, IBulletWeaponItem itemInstance, ref HumanController.InputSample sample)
    {
        bool      flag;
        Socket    socket;
        Character character = itemInstance.character;

        if (character == null)
        {
            return;
        }
        if (itemInstance.clipAmmo <= 0)
        {
            return;
        }
        Ray ray = character.eyesRay;
        int num = 1;

        itemInstance.Consume(ref num);
        uLink.BitStream bitStream   = new uLink.BitStream(false);
        float           bulletRange = this.GetBulletRange(itemRep);

        for (int i = 0; i < this.numPellets; i++)
        {
            Ray ray1 = ray;
            ray1.direction = (Quaternion.LookRotation(ray.direction) * Quaternion.Euler(UnityEngine.Random.Range(-this.xSpread, this.xSpread), UnityEngine.Random.Range(-this.ySpread, this.ySpread), 0f)) * Vector3.forward;
            Component component = null;
            this.FireSingleBullet(bitStream, ray1, itemRep, out component, out flag);
            this.MakeTracer(ray1.origin, ray1.origin + (ray1.direction * bulletRange), bulletRange, component, flag);
        }
        itemRep.ActionStream(1, uLink.RPCMode.Server, bitStream);
        bool flag1 = vm;

        if (!flag1)
        {
            socket = itemRep.muzzle;
        }
        else
        {
            socket = vm.muzzle;
        }
        this.DoWeaponEffects(character.transform, socket, flag1, itemRep);
        if (flag1)
        {
            vm.PlayFireAnimation();
        }
        float single = 1f;

        if (sample.aim)
        {
            single = single - this.aimingRecoilSubtract;
        }
        else if (sample.crouch)
        {
            single = single - this.crouchRecoilSubtract;
        }
        float            single1          = UnityEngine.Random.Range(this.recoilPitchMin, this.recoilPitchMax) * single;
        float            single2          = UnityEngine.Random.Range(this.recoilYawMin, this.recoilYawMax) * single;
        RecoilSimulation recoilSimulation = character.recoilSimulation;

        if (recoilSimulation)
        {
            recoilSimulation.AddRecoil(this.recoilDuration, single1, single2);
        }
        HeadBob headBob = CameraMount.current.GetComponent <HeadBob>();

        if (headBob && this.shotBob)
        {
            headBob.AddEffect(this.shotBob);
        }
    }
Пример #32
0
    private int Step(float dt)
    {
        double  num;
        int     num1    = 0;
        int     num2    = 0;
        HeadBob headBob = this;

        headBob.timeSolve = headBob.timeSolve + (double)dt;
        double num3 = ((double)this.cfg.solveRate >= 0 ? 1 / (double)this.cfg.solveRate : 1 / -(double)this.cfg.solveRate);

        if ((double)this.cfg.intermitRate != 0)
        {
            num = ((double)this.cfg.intermitRate >= 0 ? 1 / (double)this.cfg.intermitRate : 1 / -(double)this.cfg.intermitRate);
        }
        else
        {
            num = 0;
        }
        double num4 = num;

        if (double.IsInfinity(num3) || num3 == 0)
        {
            num3 = this.timeSolve;
        }
        bool   flag = num4 > num3;
        double num5 = num3 * (double)this.cfg.timeScale;

        if (this.timeSolve >= num3)
        {
            do
            {
                HeadBob headBob1 = this;
                headBob1.timeSolve = headBob1.timeSolve - num3;
                if (flag)
                {
                    HeadBob headBob2 = this;
                    headBob2.timeIntermit = headBob2.timeIntermit - num3;
                    if (this.timeIntermit < 0)
                    {
                        this.intermitStart = this.working;
                    }
                }
                this.Solve(ref this.working, ref num5);
                if (flag && this.timeIntermit < 0)
                {
                    this.intermitNext     = this.working;
                    this.intermitFraction = (this.timeIntermit + num3) / num3;
                    HeadBob headBob3 = this;
                    headBob3.timeIntermit = headBob3.timeIntermit + num4;
                    num2++;
                }
                num1++;
            }while (this.timeSolve >= num3);
        }
        if (flag)
        {
            if (num2 > 0)
            {
                if (!this.simStep)
                {
                    this.raw_pos = this.intermitNext.position.@value;
                    this.raw_rot = this.intermitNext.rotation.@value;
                    this.CheckDeadZone();
                }
                else
                {
                    Vector3G.Lerp(ref this.intermitStart.position.@value, ref this.intermitNext.position.@value, ref this.intermitFraction, out this.raw_pos);
                    Vector3G.Lerp(ref this.intermitStart.rotation.@value, ref this.intermitNext.rotation.@value, ref this.intermitFraction, out this.raw_rot);
                    this.CheckDeadZone();
                }
            }
            return(num2);
        }
        if (!this.simStep)
        {
            this.raw_pos = this.working.position.@value;
            this.raw_rot = this.working.rotation.@value;
            this.CheckDeadZone();
        }
        else
        {
            this.working.CopyTo(ref this.predicted);
            this.Solve(ref this.predicted, ref num5);
            num1 = -(num1 + 1);
            double num6 = this.timeSolve / num3;
            Vector3G.Lerp(ref this.working.position.@value, ref this.predicted.position.@value, ref num6, out this.raw_pos);
            Vector3G.Lerp(ref this.working.rotation.@value, ref this.predicted.rotation.@value, ref num6, out this.raw_rot);
            this.CheckDeadZone();
        }
        return(num1);
    }
Пример #33
0
    private bool Advance(float dt)
    {
        bool flag = false;

        if (!this._motor)
        {
            flag = this.CheckChanges(false, base.transform.parent ?? base.transform);
            this.PushPosition();
        }
        else
        {
            flag = this.CheckChanges(true, this._motor.idMain.transform);
            this.PushPosition();
            this.GatherInfo(this._motor);
        }
        if (this.cfg.additionalCurves == null)
        {
            this.additionalCurveCount = 0;
            this.anyAdditionalCurves  = false;
        }
        else
        {
            int length = (int)this.cfg.additionalCurves.Length;
            int num    = length;
            this.additionalCurveCount = length;
            this.anyAdditionalCurves  = num > 0;
        }
        if (this.anyAdditionalCurves)
        {
            Array.Resize <Vector3G>(ref this.working.additionalPositions, this.additionalCurveCount);
            Array.Resize <Vector3G>(ref this.predicted.additionalPositions, this.additionalCurveCount);
        }
        if (!this._allow)
        {
            if (this.allowFractionNormalized > 0f)
            {
                int num1 = this.cfg.forbidCurve.length;
                if ((float)num1 != 0f)
                {
                    HeadBob headBob = this;
                    headBob.allowFractionNormalized = headBob.allowFractionNormalized - dt / (float)num1;
                    if (this.allowFractionNormalized > 0f)
                    {
                        this.allowValue = 1f - this.cfg.forbidCurve.Evaluate((1f - this.allowFractionNormalized) * (float)num1);
                    }
                    else
                    {
                        this.allowFractionNormalized = 0f;
                        this.allowValue = 0f;
                    }
                }
                else
                {
                    this.allowFractionNormalized = 0f;
                    this.allowValue = 0f;
                }
                flag = true;
            }
            if (this._wasForbidden && this.allowFractionNormalized == 0f)
            {
                base.enabled = false;
            }
        }
        else if (this.allowFractionNormalized < 1f)
        {
            int num2 = this.cfg.allowCurve.length;
            if ((float)num2 != 0f)
            {
                HeadBob headBob1 = this;
                headBob1.allowFractionNormalized = headBob1.allowFractionNormalized + dt / (float)num2;
                if (this.allowFractionNormalized < 1f)
                {
                    this.allowValue = this.cfg.allowCurve.Evaluate(this.allowFractionNormalized * (float)num2);
                }
                else
                {
                    this.allowFractionNormalized = 1f;
                    this.allowValue = 1f;
                }
            }
            else
            {
                this.allowFractionNormalized = 1f;
                this.allowValue = 1f;
            }
            flag = true;
        }
        if (this.Step(dt) == 0 && !flag)
        {
            return(false);
        }
        return(true);
    }
Пример #34
0
    public virtual void Local_FireWeapon(ViewModel vm, ItemRepresentation itemRep, IBulletWeaponItem itemInstance, ref HumanController.InputSample sample)
    {
        Component   component;
        Vector3     point;
        RaycastHit2 raycastHit2;
        IDMain      dMain;
        Socket      item;
        bool        flag;
        bool        flag1;
        Component   component1;
        IDMain      dMain1;
        Character   character = itemInstance.character;

        if (character == null)
        {
            return;
        }
        if (itemInstance.clipAmmo <= 0)
        {
            return;
        }
        Ray         ray         = character.eyesRay;
        NetEntityID netEntityID = NetEntityID.unassigned;
        bool        flag2       = false;
        int         num         = 1;

        itemInstance.Consume(ref num);
        bool       flag3      = Physics2.Raycast2(ray, out raycastHit2, this.GetBulletRange(itemRep), 406721553);
        TakeDamage takeDamage = null;

        if (!flag3)
        {
            dMain     = null;
            point     = ray.GetPoint(1000f);
            component = null;
        }
        else
        {
            point = raycastHit2.point;
            IDBase dBase = raycastHit2.id;
            if (!raycastHit2.remoteBodyPart)
            {
                component1 = raycastHit2.collider;
            }
            else
            {
                component1 = raycastHit2.remoteBodyPart;
            }
            component = component1;
            if (!dBase)
            {
                dMain1 = null;
            }
            else
            {
                dMain1 = dBase.idMain;
            }
            dMain = dMain1;
            if (dMain)
            {
                netEntityID = NetEntityID.Get(dMain);
                if (!netEntityID.isUnassigned)
                {
                    flag2      = true;
                    takeDamage = dMain.GetComponent <TakeDamage>();
                    if (takeDamage && takeDamage.ShouldPlayHitNotification())
                    {
                        this.PlayHitNotification(point, character);
                    }
                    bool flag4 = false;
                    if (raycastHit2.remoteBodyPart)
                    {
                        BodyPart bodyPart = raycastHit2.remoteBodyPart.bodyPart;
                        switch (bodyPart)
                        {
                        case BodyPart.Brain:
                        case BodyPart.L_Eye:
                        case BodyPart.R_Eye:
                        {
Label0:
                            flag4 = true;
                            break;
                        }

                        default:
                        {
                            switch (bodyPart)
                            {
                            case BodyPart.Head:
                            case BodyPart.Jaw:
                            {
                                goto Label0;
                            }

                            case BodyPart.Scalp:
                            case BodyPart.Nostrils:
                            {
                                flag4 = false;
                                break;
                            }

                            default:
                            {
                                goto case BodyPart.Nostrils;
                            }
                            }
                            break;
                        }
                        }
                    }
                    if (flag4)
                    {
                        this.headshotSound.Play();
                    }
                }
            }
        }
        if (!flag3)
        {
            flag1 = false;
        }
        else
        {
            flag1 = (!raycastHit2.isHitboxHit || raycastHit2.bodyPart.IsDefined() ? true : takeDamage != null);
        }
        bool flag5 = flag1;

        if (!vm)
        {
            item = itemRep.muzzle;
            flag = false;
        }
        else
        {
            item = vm.socketMap["muzzle"].socket;
            flag = true;
        }
        Vector3 vector3 = item.position;

        this.DoWeaponEffects(character.transform, vector3, point, item, flag, component, flag5, itemRep);
        if (flag)
        {
            vm.PlayFireAnimation();
        }
        float single = 1f;

        if ((!sample.aim ? false : sample.crouch))
        {
            single = single - (this.aimingRecoilSubtract + this.crouchRecoilSubtract * 0.5f);
        }
        else if (sample.aim)
        {
            single = single - this.aimingRecoilSubtract;
        }
        else if (sample.crouch)
        {
            single = single - this.crouchRecoilSubtract;
        }
        single = Mathf.Clamp01(single);
        float single1 = UnityEngine.Random.Range(this.recoilPitchMin, this.recoilPitchMax) * single;
        float single2 = UnityEngine.Random.Range(this.recoilYawMin, this.recoilYawMax) * single;

        if (BulletWeaponDataBlock.weaponRecoil && character.recoilSimulation)
        {
            character.recoilSimulation.AddRecoil(this.recoilDuration, single1, single2);
        }
        HeadBob headBob = CameraMount.current.GetComponent <HeadBob>();

        if (headBob && this.shotBob && BulletWeaponDataBlock.headRecoil)
        {
            headBob.AddEffect(this.shotBob);
        }
        uLink.BitStream bitStream = new uLink.BitStream(false);
        this.WriteHitInfo(bitStream, ref ray, flag3, ref raycastHit2, flag2, netEntityID);
        itemRep.ActionStream(1, uLink.RPCMode.Server, bitStream);
    }
Пример #35
0
 private void Solve(ref HeadBob.Weight weight, ref double dt)
 {
     Vector3G vector3G = new Vector3G();
     double num;
     vector3G.x = dt * this.groundLocalVelocity.x * (double)this.cfg.forceSpeedMultiplier.x;
     vector3G.y = dt * this.groundLocalVelocity.y * (double)this.cfg.forceSpeedMultiplier.y;
     vector3G.z = dt * this.groundLocalVelocity.z * (double)this.cfg.forceSpeedMultiplier.z;
     Vector3G vector3G1 = weight.position.fE;
     Vector3G vector3G2 = weight.rotation.fE;
     Vector3G vector3G3 = new Vector3G();
     weight.position.fE = vector3G3;
     Vector3G vector3G4 = new Vector3G();
     weight.rotation.fE = vector3G4;
     if (this.anyAdditionalCurves)
     {
         for (int i = 0; i < this.additionalCurveCount; i++)
         {
             BobForceCurve bobForceCurve = this.cfg.additionalCurves[i];
             switch (bobForceCurve.source)
             {
                 case BobForceCurveSource.LocalMovementMagnitude:
                 {
                     num = this.groundLocalVelocityMag;
                     break;
                 }
                 case BobForceCurveSource.LocalMovementX:
                 {
                     num = this.groundLocalVelocity.x;
                     break;
                 }
                 case BobForceCurveSource.LocalMovementY:
                 {
                     num = this.groundLocalVelocity.y;
                     break;
                 }
                 case BobForceCurveSource.LocalMovementZ:
                 {
                     num = this.groundLocalVelocity.z;
                     break;
                 }
                 case BobForceCurveSource.WorldMovementMagnitude:
                 {
                     num = this.groundWorldVelocityMag;
                     break;
                 }
                 case BobForceCurveSource.WorldMovementX:
                 {
                     num = this.groundWorldVelocity.x;
                     break;
                 }
                 case BobForceCurveSource.WorldMovementY:
                 {
                     num = this.groundWorldVelocity.y;
                     break;
                 }
                 case BobForceCurveSource.WorldMovementZ:
                 {
                     num = this.groundWorldVelocity.z;
                     break;
                 }
                 case BobForceCurveSource.LocalVelocityMagnitude:
                 {
                     num = this.localVelocityMag;
                     break;
                 }
                 case BobForceCurveSource.LocalVelocityX:
                 {
                     num = this.localVelocity.x;
                     break;
                 }
                 case BobForceCurveSource.LocalVelocityY:
                 {
                     num = this.localVelocity.y;
                     break;
                 }
                 case BobForceCurveSource.LocalVelocityZ:
                 {
                     num = this.localVelocity.z;
                     break;
                 }
                 case BobForceCurveSource.WorldVelocityMagnitude:
                 {
                     num = this.worldVelocityMag;
                     break;
                 }
                 case BobForceCurveSource.WorldVelocityX:
                 {
                     num = this.worldVelocity.x;
                     break;
                 }
                 case BobForceCurveSource.WorldVelocityY:
                 {
                     num = this.worldVelocity.y;
                     break;
                 }
                 case BobForceCurveSource.WorldVelocityZ:
                 {
                     num = this.worldVelocity.z;
                     break;
                 }
                 case BobForceCurveSource.RotationMagnitude:
                 {
                     num = this.localAngularVelocityMag;
                     break;
                 }
                 case BobForceCurveSource.RotationPitch:
                 {
                     num = this.localAngularVelocity.x;
                     break;
                 }
                 case BobForceCurveSource.RotationYaw:
                 {
                     num = this.localAngularVelocity.y;
                     break;
                 }
                 case BobForceCurveSource.RotationRoll:
                 {
                     num = this.localAngularVelocity.z;
                     break;
                 }
                 case BobForceCurveSource.TurnMagnitude:
                 {
                     num = this.groundLocalAngularVelocityMag;
                     break;
                 }
                 case BobForceCurveSource.TurnPitch:
                 {
                     num = this.groundLocalAngularVelocity.x;
                     break;
                 }
                 case BobForceCurveSource.TurnYaw:
                 {
                     num = this.groundLocalAngularVelocity.y;
                     break;
                 }
                 case BobForceCurveSource.TurnRoll:
                 {
                     num = this.groundLocalAngularVelocity.z;
                     break;
                 }
                 default:
                 {
                     goto case BobForceCurveSource.LocalVelocityZ;
                 }
             }
             BobForceCurveTarget bobForceCurveTarget = bobForceCurve.target;
             if (bobForceCurveTarget != BobForceCurveTarget.Position)
             {
                 if (bobForceCurveTarget != BobForceCurveTarget.Rotation)
                 {
                     goto Label3;
                 }
                 bobForceCurve.Calculate(ref weight.additionalPositions[i], ref num, ref dt, ref weight.rotation.fE);
                 goto Label1;
             }
         Label3:
             bobForceCurve.Calculate(ref weight.additionalPositions[i], ref num, ref dt, ref weight.position.fE);
         Label1:
         }
     }
     if (this.cfg.impulseForceSmooth <= 0f)
     {
         weight.position.fI = this.impulseForce.accel;
     }
     else
     {
         Vector3G.SmoothDamp(ref weight.position.fI, ref this.impulseForce.accel, ref weight.position.fIV, this.cfg.impulseForceSmooth, this.cfg.impulseForceMaxChangeAcceleration, ref dt);
     }
     if (this.cfg.angleImpulseForceSmooth <= 0f)
     {
         weight.rotation.fI = this.impulseTorque.accel;
     }
     else
     {
         Vector3G.SmoothDamp(ref weight.rotation.fI, ref this.impulseTorque.accel, ref weight.rotation.fIV, this.cfg.angleImpulseForceSmooth, this.cfg.angleImpulseForceMaxChangeAcceleration, ref dt);
     }
     weight.position.fE.x = weight.position.fE.x + (this.inputForce.x + weight.position.fI.x * (double)this.cfg.impulseForceScale.x);
     weight.position.fE.y = weight.position.fE.y + (this.inputForce.y + weight.position.fI.y * (double)this.cfg.impulseForceScale.y);
     weight.position.fE.z = weight.position.fE.z + (this.inputForce.z + weight.position.fI.z * (double)this.cfg.impulseForceScale.z);
     weight.rotation.fE.x = weight.rotation.fE.x + weight.rotation.fI.x * (double)this.cfg.angularImpulseForceScale.x;
     weight.rotation.fE.y = weight.rotation.fE.y + weight.rotation.fI.y * (double)this.cfg.angularImpulseForceScale.y;
     weight.rotation.fE.z = weight.rotation.fE.z + weight.rotation.fI.z * (double)this.cfg.angularImpulseForceScale.z;
     Vector3G vector3G5 = weight.position.@value;
     vector3G5.x = vector3G5.x / (double)this.cfg.elipsoidRadii.x;
     vector3G5.y = vector3G5.y / (double)this.cfg.elipsoidRadii.y;
     vector3G5.z = vector3G5.z / (double)this.cfg.elipsoidRadii.z;
     double num1 = vector3G5.x * vector3G5.x + vector3G5.y * vector3G5.y + vector3G5.z * vector3G5.z;
     if (num1 > 1)
     {
         num1 = 1 / Math.Sqrt(num1);
         vector3G5.x = vector3G5.x * num1;
         vector3G5.y = vector3G5.y * num1;
         vector3G5.z = vector3G5.z * num1;
     }
     vector3G5.x = vector3G5.x * (double)this.cfg.elipsoidRadii.x;
     vector3G5.y = vector3G5.y * (double)this.cfg.elipsoidRadii.y;
     vector3G5.z = vector3G5.z * (double)this.cfg.elipsoidRadii.z;
     weight.stack.Simulate(ref dt, ref weight.position.fE, ref weight.rotation.fE);
     weight.position.acceleration.x = weight.position.fE.x - vector3G1.x + (vector3G5.x * (double)(-this.cfg.springConstant.x) - weight.position.velocity.x * (double)this.cfg.springDampen.x) * (double)this.cfg.weightMass;
     weight.position.acceleration.y = weight.position.fE.y - vector3G1.y + (vector3G5.y * (double)(-this.cfg.springConstant.y) - weight.position.velocity.y * (double)this.cfg.springDampen.y) * (double)this.cfg.weightMass;
     weight.position.acceleration.z = weight.position.fE.z - vector3G1.z + (vector3G5.z * (double)(-this.cfg.springConstant.z) - weight.position.velocity.z * (double)this.cfg.springDampen.z) * (double)this.cfg.weightMass;
     weight.position.velocity.x = weight.position.velocity.x + weight.position.acceleration.x * dt;
     weight.position.velocity.y = weight.position.velocity.y + weight.position.acceleration.y * dt;
     weight.position.velocity.z = weight.position.velocity.z + weight.position.acceleration.z * dt;
     if (float.IsInfinity(this.cfg.maxVelocity.x))
     {
         [email protected] = [email protected] + weight.position.velocity.x * dt;
     }
     else if (weight.position.velocity.x < (double)(-this.cfg.maxVelocity.x))
     {
         [email protected] = [email protected] - (double)this.cfg.maxVelocity.x * dt;
     }
     else if (weight.position.velocity.x <= (double)this.cfg.maxVelocity.x)
     {
         [email protected] = [email protected] + weight.position.velocity.x * dt;
     }
     else
     {
         [email protected] = [email protected] + (double)this.cfg.maxVelocity.x * dt;
     }
     if (float.IsInfinity(this.cfg.maxVelocity.y))
     {
         [email protected] = [email protected] + weight.position.velocity.y * dt;
     }
     else if (weight.position.velocity.y < (double)(-this.cfg.maxVelocity.y))
     {
         [email protected] = [email protected] - (double)this.cfg.maxVelocity.y * dt;
     }
     else if (weight.position.velocity.y <= (double)this.cfg.maxVelocity.y)
     {
         [email protected] = [email protected] + weight.position.velocity.y * dt;
     }
     else
     {
         [email protected] = [email protected] + (double)this.cfg.maxVelocity.y * dt;
     }
     if (float.IsInfinity(this.cfg.maxVelocity.z))
     {
         [email protected] = [email protected] + weight.position.velocity.z * dt;
     }
     else if (weight.position.velocity.z < (double)(-this.cfg.maxVelocity.z))
     {
         [email protected] = [email protected] - (double)this.cfg.maxVelocity.z * dt;
     }
     else if (weight.position.velocity.z <= (double)this.cfg.maxVelocity.z)
     {
         [email protected] = [email protected] + weight.position.velocity.z * dt;
     }
     else
     {
         [email protected] = [email protected] + (double)this.cfg.maxVelocity.z * dt;
     }
     weight.rotation.acceleration.x = weight.rotation.fE.x - vector3G2.x + ([email protected] * (double)(-this.cfg.angularSpringConstant.x) - weight.rotation.velocity.x * (double)this.cfg.angularSpringDampen.x) * (double)this.cfg.angularWeightMass;
     weight.rotation.acceleration.y = weight.rotation.fE.y - vector3G2.y + ([email protected] * (double)(-this.cfg.angularSpringConstant.y) - weight.rotation.velocity.y * (double)this.cfg.angularSpringDampen.y) * (double)this.cfg.angularWeightMass;
     weight.rotation.acceleration.z = weight.rotation.fE.z - vector3G2.z + ([email protected] * (double)(-this.cfg.angularSpringConstant.z) - weight.rotation.velocity.z * (double)this.cfg.angularSpringDampen.z) * (double)this.cfg.angularWeightMass;
     weight.rotation.velocity.x = weight.rotation.velocity.x + weight.rotation.acceleration.x * dt;
     weight.rotation.velocity.y = weight.rotation.velocity.y + weight.rotation.acceleration.y * dt;
     weight.rotation.velocity.z = weight.rotation.velocity.z + weight.rotation.acceleration.z * dt;
     [email protected] = [email protected] + weight.rotation.velocity.x * dt;
     [email protected] = [email protected] + weight.rotation.velocity.y * dt;
     [email protected] = [email protected] + weight.rotation.velocity.z * dt;
 }