// Token: 0x06002D16 RID: 11542 RVA: 0x000A8960 File Offset: 0x000A6B60
 public void FallImpact(float fallspeed)
 {
     this.legBreakSound.Play(base.transform.position, 1f, 3f, 10f);
     if (base.localControlled)
     {
         global::HeadBob component = global::CameraMount.current.GetComponent <global::HeadBob>();
         component.AddEffect(this.fallbob);
     }
 }
Esempio n. 2
0
    // Token: 0x060003FA RID: 1018 RVA: 0x00013440 File Offset: 0x00011640
    private void SetLocalOnlyComponentsEnabled(bool enable)
    {
        global::CCMotor component = base.GetComponent <global::CCMotor>();

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

        if (componentInChildren)
        {
            componentInChildren.open = enable;
            global::HeadBob component2 = componentInChildren.GetComponent <global::HeadBob>();
            if (component2)
            {
                component2.enabled = enable;
            }
            global::LazyCam component3 = componentInChildren.GetComponent <global::LazyCam>();
            if (component3)
            {
                component3.enabled = enable;
            }
        }
        global::LocalDamageDisplay component4 = base.GetComponent <global::LocalDamageDisplay>();

        if (component4)
        {
            component4.enabled = enable;
        }
    }
Esempio n. 3
0
    // Token: 0x06002D2E RID: 11566 RVA: 0x000A8EC8 File Offset: 0x000A70C8
    public void Hurt(float percent, GameObject attacker)
    {
        if (percent < 0.05f)
        {
            return;
        }
        this.lastTakeDamageTime = Time.time;
        if (global::CameraMount.current == null)
        {
            return;
        }
        global::HeadBob component = global::CameraMount.current.GetComponent <global::HeadBob>();

        if (component == null)
        {
            Debug.Log("no camera headbob");
        }
        if (component)
        {
            bool flag;
            if (attacker)
            {
                global::Controllable component2 = attacker.GetComponent <global::Controllable>();
                flag = (component2 && component2.npcName == "zombie");
                if (!flag)
                {
                    flag = (attacker.GetComponent <global::BasicWildLifeAI>() != null);
                }
            }
            else
            {
                flag = false;
            }
            component.AddEffect((!flag) ? this.takeDamageBob : this.meleeBob);
        }
    }
Esempio n. 4
0
    // Token: 0x060035F9 RID: 13817 RVA: 0x000C4EDC File Offset: 0x000C30DC
    public override void Local_FireWeapon(global::ViewModel vm, global::ItemRepresentation itemRep, global::IBulletWeaponItem itemInstance, ref global::HumanController.InputSample sample)
    {
        global::Character character = itemInstance.character;

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

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

        for (int i = 0; i < this.numPellets; i++)
        {
            Ray ray = eyesRay;
            ray.direction = Quaternion.LookRotation(eyesRay.direction) * Quaternion.Euler(Random.Range(-this.xSpread, this.xSpread), Random.Range(-this.ySpread, this.ySpread), 0f) * Vector3.forward;
            Component component = null;
            bool      allowBlood;
            this.FireSingleBullet(bitStream, ray, itemRep, out component, out allowBlood);
            this.MakeTracer(ray.origin, ray.origin + ray.direction * bulletRange, bulletRange, component, allowBlood);
        }
        itemRep.ActionStream(1, 0, bitStream);
        bool           flag = vm;
        global::Socket muzzle;

        if (flag)
        {
            muzzle = vm.muzzle;
        }
        else
        {
            muzzle = itemRep.muzzle;
        }
        this.DoWeaponEffects(character.transform, muzzle, flag, itemRep);
        if (flag)
        {
            vm.PlayFireAnimation();
        }
        float num2 = 1f;

        if (sample.aim)
        {
            num2 -= this.aimingRecoilSubtract;
        }
        else if (sample.crouch)
        {
            num2 -= this.crouchRecoilSubtract;
        }
        float pitch = Random.Range(this.recoilPitchMin, this.recoilPitchMax) * num2;
        float yaw   = Random.Range(this.recoilYawMin, this.recoilYawMax) * num2;
        global::RecoilSimulation recoilSimulation = character.recoilSimulation;

        if (recoilSimulation)
        {
            recoilSimulation.AddRecoil(this.recoilDuration, pitch, yaw);
        }
        global::HeadBob component2 = global::CameraMount.current.GetComponent <global::HeadBob>();

        if (component2 && this.shotBob)
        {
            component2.AddEffect(this.shotBob);
        }
    }
Esempio n. 5
0
    // Token: 0x06003316 RID: 13078 RVA: 0x000C07F8 File Offset: 0x000BE9F8
    public virtual void Local_FireWeapon(global::ViewModel vm, global::ItemRepresentation itemRep, global::IBulletWeaponItem itemInstance, ref global::HumanController.InputSample sample)
    {
        global::Character character = itemInstance.character;

        if (character == null)
        {
            return;
        }
        if (itemInstance.clipAmmo <= 0)
        {
            return;
        }
        Ray eyesRay = character.eyesRay;
        global::NetEntityID hitView = global::NetEntityID.unassigned;
        bool hitNetworkView         = false;
        int  num = 1;

        itemInstance.Consume(ref num);
        RaycastHit2        raycastHit;
        bool               flag       = Physics2.Raycast2(eyesRay, ref raycastHit, this.GetBulletRange(itemRep), 406721553);
        global::TakeDamage takeDamage = null;
        Vector3            point;
        Component          hitComponent;

        if (flag)
        {
            point = raycastHit.point;
            IDBase id = raycastHit.id;
            hitComponent = ((!raycastHit.remoteBodyPart) ? raycastHit.collider : raycastHit.remoteBodyPart);
            IDMain idmain = (!id) ? null : id.idMain;
            if (idmain)
            {
                hitView = global::NetEntityID.Get(idmain);
                if (!hitView.isUnassigned)
                {
                    hitNetworkView = true;
                    takeDamage     = idmain.GetComponent <global::TakeDamage>();
                    if (takeDamage && takeDamage.ShouldPlayHitNotification())
                    {
                        this.PlayHitNotification(point, character);
                    }
                    bool flag2 = false;
                    if (raycastHit.remoteBodyPart)
                    {
                        BodyPart bodyPart = raycastHit.remoteBodyPart.bodyPart;
                        switch (bodyPart)
                        {
                        case 16:
                        case 20:
                        case 21:
                            break;

                        default:
                            switch (bodyPart)
                            {
                            case 9:
                            case 12:
                                goto IL_164;
                            }
                            flag2 = false;
                            goto IL_174;
                        }
IL_164:
                        flag2 = true;
                    }
IL_174:
                    if (flag2)
                    {
                        this.headshotSound.Play();
                    }
                }
            }
        }
        else
        {
            point        = eyesRay.GetPoint(1000f);
            hitComponent = null;
        }
        bool           allowBlood = flag && (!raycastHit.isHitboxHit || BodyParts.IsDefined(raycastHit.bodyPart) || takeDamage != null);
        global::Socket socket;
        bool           flag3;

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

        this.DoWeaponEffects(character.transform, position, point, socket, flag3, hitComponent, allowBlood, itemRep);
        if (flag3)
        {
            vm.PlayFireAnimation();
        }
        float num2  = 1f;
        bool  flag4 = sample.aim && sample.crouch;

        if (flag4)
        {
            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 (!global::BulletWeaponDataBlock.weaponRecoil && character.recoilSimulation)
        {
            character.recoilSimulation.AddRecoil(this.recoilDuration, pitch, yaw);
        }
        global::HeadBob component = global::CameraMount.current.GetComponent <global::HeadBob>();

        if (component && this.shotBob && global::BulletWeaponDataBlock.headRecoil)
        {
            component.AddEffect(this.shotBob);
        }
        BitStream bitStream = new BitStream(false);

        this.WriteHitInfo(bitStream, ref eyesRay, flag, ref raycastHit, hitNetworkView, hitView);
        itemRep.ActionStream(1, 0, bitStream);
    }