// Token: 0x06002BCE RID: 11214 RVA: 0x000A395C File Offset: 0x000A1B5C private void SetViewModel(global::ViewModel vm, global::ItemRepresentation rep, global::IHeldItem item) { if (!this.awoke) { this.viewModel = vm; this.rep = rep; this.item = item; return; } if (this.viewModel != vm) { bool flag = this.viewModel; if (flag) { if (this.viewModel.itemRep) { try { this.viewModel.itemRep.UnBindViewModel(this.viewModel, this.viewModel.item); } catch (Exception ex) { Debug.LogException(ex, this.viewModel.itemRep); } } this.viewModel.UnBindTransforms(); this.viewModel.idMain = null; } this.viewModel = vm; if (vm) { if (!global::CameraFX.viewModelRootTransform) { Transform transform = new GameObject("__View Model Root").transform; global::CameraFX.viewModelRootTransform = new GameObject("Eye Camera Difference").transform; global::CameraFX.viewModelRootTransform.parent = transform; } vm.idMain = this.idMain; vm.transform.parent = global::CameraFX.viewModelRootTransform; if (rep) { rep.PrepareViewModel(vm, item); } vm.BindTransforms(global::CameraFX.viewModelRootTransform, base.transform.parent); if (rep) { rep.BindViewModel(vm, item); vm.itemRep = rep; vm.item = item; } } for (int i = this._effects.Length - 1; i >= 0; i--) { if (this._effects[i]) { this.effects[i].OnViewModelChange(vm); } } } }
// Token: 0x06003536 RID: 13622 RVA: 0x000C3AF8 File Offset: 0x000C1CF8 public virtual void Local_SecondaryFire(global::ViewModel vm, global::ItemRepresentation itemRep, global::IMeleeWeaponItem itemInstance, ref global::HumanController.InputSample sample) { global::Character character = itemInstance.character; if (character == null) { return; } Ray eyesRay = character.eyesRay; RaycastHit raycastHit; bool flag = Physics.SphereCast(eyesRay, 0.3f, ref raycastHit, this.GetRange(), 406721553); if (flag) { IDBase component = raycastHit.collider.gameObject.GetComponent <IDBase>(); if (component) { global::NetEntityID netEntityID = global::NetEntityID.Get(component); global::RepairReceiver local = component.GetLocal <global::RepairReceiver>(); if (local != null && netEntityID != global::NetEntityID.unassigned) { if (vm) { vm.PlayFireAnimation(); } itemInstance.QueueSwingSound(Time.time + this.swingSoundDelay); itemRep.Action <global::NetEntityID>(2, 0, netEntityID); } } } }
// Token: 0x06003231 RID: 12849 RVA: 0x000BF3FC File Offset: 0x000BD5FC public void Ignite(global::ViewModel vm, global::ItemRepresentation itemRep, global::IBasicTorchItem torchItem) { if (torchItem != null) { torchItem.Ignite(); } bool flag = vm != null; if (flag) { GameObject light = vm.socketMap["muzzle"].socket.InstantiateAsChild(this.FirstPersonLightPrefab, false); if (torchItem != null) { torchItem.light = light; } } else if ((torchItem == null || !torchItem.light) && (!itemRep.networkView.isMine || global::actor.forceThirdPerson)) { if (this.ThirdPersonLightPrefab) { ((global::BasicTorchItemRep)itemRep)._myLightPrefab = this.ThirdPersonLightPrefab; } ((global::BasicTorchItemRep)itemRep).RepIgnite(); if (((global::BasicTorchItemRep)itemRep)._myLight && torchItem != null) { torchItem.light = ((global::BasicTorchItemRep)itemRep)._myLight; } } }
// Token: 0x06002BD2 RID: 11218 RVA: 0x000A3BA4 File Offset: 0x000A1DA4 public static void RemoveViewModel(ref global::ViewModel vm, bool deleteEvenIfNotCurrent, bool removeCurrentIfNotVM) { if (!vm) { if (removeCurrentIfNotVM) { global::CameraFX.RemoveViewModel(); } return; } if (global::CameraFX.mainViewModel == vm) { global::CameraFX.ReplaceViewModel(null, false); vm = null; } else { if (deleteEvenIfNotCurrent) { Object.Destroy(vm.gameObject); vm = null; } if (removeCurrentIfNotVM) { global::CameraFX.ReplaceViewModel(null, false); } } }
// Token: 0x060035CE RID: 13774 RVA: 0x000C4BE4 File Offset: 0x000C2DE4 public ModViewModelAddArgs(global::ViewModel vm, global::IHeldItem item, bool isMesh, global::ItemModRepresentation modRep) { this.vm = vm; this.item = item; this.isMesh = isMesh; this.modRep = modRep; }
// Token: 0x06002E18 RID: 11800 RVA: 0x000AE7EC File Offset: 0x000AC9EC void global::ICameraFX.OnViewModelChange(global::ViewModel viewModel) { if (this.viewModel != viewModel) { this._viewModelPositionScalar = 1f; this._viewModelRotationScalar = 1f; Transform transform; if (this.viewModel) { transform = this.viewModel.transform; this.viewModel.headBob = null; } else { transform = base.transform; } Transform transform2; if (viewModel) { viewModel.headBob = this; transform2 = viewModel.transform; } else { transform2 = base.transform; } this.viewModel = viewModel; if (!transform) { } if (!transform2) { } } }
// Token: 0x06003444 RID: 13380 RVA: 0x000C2BF4 File Offset: 0x000C0DF4 public override void PrimaryAttack(global::ViewModel vm, global::ItemRepresentation itemRep, global::IThrowableItem itemInstance, ref global::HumanController.InputSample sample) { base.PrimaryAttack(vm, itemRep, itemInstance, ref sample); vm.Play("pull_pin"); this.pullPinSound.Play(); this.GetHandGrenadeItemInstance(itemInstance).nextPrimaryAttackTime = Time.time + 1000f; this.GetHandGrenadeItemInstance(itemInstance).nextSecondaryAttackTime = Time.time + 1000f; }
// Token: 0x060032C2 RID: 12994 RVA: 0x000C02C0 File Offset: 0x000BE4C0 public virtual void Local_CancelArrow(global::ViewModel vm, global::ItemRepresentation itemRep, global::IBowWeaponItem itemInstance, ref global::HumanController.InputSample sample) { if (vm) { vm.CrossFade("cancelarrow", 0.15f); } this.MakeReadyIn(itemInstance, this.fireRate * 3f); this.cancelArrowSound.PlayLocal(Camera.main.transform, Vector3.zero, 1f, 1f, 3f, 20f, 0); }
// Token: 0x06003315 RID: 13077 RVA: 0x000C07B4 File Offset: 0x000BE9B4 public virtual void Local_Reload(global::ViewModel vm, global::ItemRepresentation itemRep, global::IBulletWeaponItem itemInstance, ref global::HumanController.InputSample sample) { if (vm) { vm.PlayReloadAnimation(); } this.reloadSound.PlayLocal(itemRep.transform, Vector3.zero, 1f, 0); itemRep.Action(3, 0); }
// Token: 0x0600363D RID: 13885 RVA: 0x000C54D0 File Offset: 0x000C36D0 public virtual void Local_BeginStrikes(int numStrikes, global::ViewModel vm, global::ItemRepresentation itemRep, global::IStrikeGunItem itemInstance, ref global::HumanController.InputSample sample) { string name = "strike" + numStrikes; vm.Play(name, 4); AudioClip clip = this.strikeSounds[numStrikes - 1]; clip.PlayLocal(Camera.main.transform, Vector3.zero, 1f, Random.Range(0.96f, 1.03f), 2f, 2f, 0); }
// Token: 0x0600388A RID: 14474 RVA: 0x000C8C84 File Offset: 0x000C6E84 private void RunViewModelAdd(global::ViewModel vm, global::IHeldItem item, bool doMeshes) { global::ModViewModelAddArgs modViewModelAddArgs = new global::ModViewModelAddArgs(vm, item, doMeshes); for (int i = 0; i < 5; i++) { this._itemMods.BindAsLocal(i, ref modViewModelAddArgs, this); } }
// Token: 0x060032BC RID: 12988 RVA: 0x000C0088 File Offset: 0x000BE288 public virtual void Local_ReadyArrow(global::ViewModel vm, global::ItemRepresentation itemRep, global::IBowWeaponItem itemInstance, ref global::HumanController.InputSample sample) { if (vm) { vm.Play("drawarrow", 0); } itemInstance.completeDrawTime = Time.time + this.drawLength; this.drawArrowSound.PlayLocal(Camera.main.transform, Vector3.zero, 1f, 1f, 3f, 20f, 0); }
// Token: 0x060039E1 RID: 14817 RVA: 0x000CBD38 File Offset: 0x000C9F38 public virtual void CancelAttack(ref global::HumanController.InputSample sample) { if (this.beganFiring) { global::ViewModel viewModelInstance = base.viewModelInstance; T datablock = this.datablock; datablock.Local_CancelStrikes(base.viewModelInstance, base.itemRepresentation, this.iface as global::IStrikeGunItem, ref sample); base.nextPrimaryAttackTime = Time.time + 1f; this.ResetFiring(); } }
// Token: 0x060032C5 RID: 12997 RVA: 0x000C033C File Offset: 0x000BE53C public virtual void Local_GetTired(global::ViewModel vm, global::ItemRepresentation itemRep, global::IBowWeaponItem itemInstance, ref global::HumanController.InputSample sample) { if (itemInstance.tired) { return; } if (vm) { vm.CrossFade("tiredloop", 5f); } }
// Token: 0x0600388D RID: 14477 RVA: 0x000C8CE4 File Offset: 0x000C6EE4 internal void UnBindViewModel(global::ViewModel vm, global::IHeldItem item) { global::ModViewModelRemoveArgs modViewModelRemoveArgs = new global::ModViewModelRemoveArgs(vm, item); for (int i = 0; i < 5; i++) { this._itemMods.UnBindAsLocal(i, ref modViewModelRemoveArgs, this); } if (this._lastViewModel == vm) { this._lastViewModel = null; } }
// Token: 0x06003537 RID: 13623 RVA: 0x000C3BBC File Offset: 0x000C1DBC public virtual void Local_FireWeapon(global::ViewModel vm, global::ItemRepresentation itemRep, global::IMeleeWeaponItem itemInstance, ref global::HumanController.InputSample sample) { this.StartSwingWorldAnimations(itemRep); if (vm) { vm.PlayFireAnimation(); } itemInstance.QueueSwingSound(Time.time + this.swingSoundDelay); itemInstance.QueueMidSwing(Time.time + this.midSwingDelay); if (itemRep.networkViewIsMine) { itemRep.Action(3, 0); } }
// Token: 0x06002BD0 RID: 11216 RVA: 0x000A3B30 File Offset: 0x000A1D30 public static void ReplaceViewModel(global::ViewModel vm, global::ItemRepresentation rep, global::IHeldItem item, bool butDontDestroyOld) { global::CameraFX mainCameraFX = global::CameraFX.mainCameraFX; if (mainCameraFX && mainCameraFX.viewModel != vm) { global::ViewModel viewModel = mainCameraFX.viewModel; mainCameraFX.SetViewModel(vm, rep, item); if (!butDontDestroyOld && viewModel) { Object.Destroy(viewModel.gameObject); } } }
// Token: 0x06003910 RID: 14608 RVA: 0x000CA1E4 File Offset: 0x000C83E4 public override void PrimaryAttack(ref global::HumanController.InputSample sample) { base.nextPrimaryAttackTime = Time.time + this.datablock.fireRate; if (this.datablock.NoAimingAfterShot) { this.nextAimTime = Time.time + this.datablock.fireRate; } global::ViewModel vm = base.viewModelInstance; if (global::actor.forceThirdPerson) { vm = null; } T datablock = this.datablock; datablock.Local_FireWeapon(vm, base.itemRepresentation, this.iface as global::IBulletWeaponItem, ref sample); }
// Token: 0x06003761 RID: 14177 RVA: 0x000C6454 File Offset: 0x000C4654 public override void PrimaryAttack(global::ViewModel vm, global::ItemRepresentation itemRep, global::IThrowableItem itemInstance, ref global::HumanController.InputSample sample) { global::ITorchItem torchInstance = this.GetTorchInstance(itemInstance); if (torchInstance.isLit) { return; } if (vm) { vm.Play("ignite"); } torchInstance.realIgniteTime = Time.time + 0.8f; torchInstance.nextPrimaryAttackTime = Time.time + 1.5f; torchInstance.nextSecondaryAttackTime = Time.time + 1.5f; }
// Token: 0x06002BC5 RID: 11205 RVA: 0x000A2C70 File Offset: 0x000A0E70 protected void Awake() { this.camera = base.camera; this.adaptiveNearPlane = base.GetComponent <global::AdaptiveNearPlane>(); int num = 0; if (this._effects != null && this._effects.Length != 0) { for (int i = 0; i < this._effects.Length; i++) { if (this._effects[i] && this._effects[i] is global::ICameraFX) { this._effects[num++] = this._effects[i]; } else { Debug.LogWarning("effect at index " + i + " is missing, null or not a ICameraFX", this); } } } Array.Resize <MonoBehaviour>(ref this._effects, num); Array.Resize <global::ICameraFX>(ref this.effects, num); if (num == 0) { Debug.LogWarning("There are no effects", this); } else { for (int j = 0; j < num; j++) { this.effects[j] = (global::ICameraFX)this._effects[j]; } } this.awoke = true; if (this.viewModel) { global::ViewModel vm = this.viewModel; this.viewModel = null; global::ItemRepresentation itemRepresentation = this.rep; this.rep = null; global::IHeldItem heldItem = this.item; this.item = null; this.SetViewModel(vm, itemRepresentation, heldItem); } base.Awake(); }
// Token: 0x06003445 RID: 13381 RVA: 0x000C2C54 File Offset: 0x000C0E54 public override void AttackReleased(global::ViewModel vm, global::ItemRepresentation itemRep, global::IThrowableItem itemInstance, ref global::HumanController.InputSample sample) { Debug.Log("Attack released!!!"); vm.Play("throw"); vm.PlayQueued("deploy"); this.GetHandGrenadeItemInstance(itemInstance).nextPrimaryAttackTime = Time.time + 1f; this.GetHandGrenadeItemInstance(itemInstance).nextSecondaryAttackTime = Time.time + 1f; global::Character component = global::PlayerClient.GetLocalPlayer().controllable.GetComponent <global::Character>(); Vector3 eyesOrigin = component.eyesOrigin; Vector3 forward = component.eyesAngles.forward; BitStream bitStream = new BitStream(false); bitStream.WriteVector3(eyesOrigin); bitStream.WriteVector3(forward * this.GetHandGrenadeItemInstance(itemInstance).heldThrowStrength); Debug.Log("Throw strength is : " + this.GetHandGrenadeItemInstance(itemInstance).heldThrowStrength); this.GetHandGrenadeItemInstance(itemInstance).EndHoldingBack(); itemRep.ActionStream(1, 0, bitStream); }
// Token: 0x06003AEA RID: 15082 RVA: 0x000D0588 File Offset: 0x000CE788 void global::ICameraFX.OnViewModelChange(global::ViewModel viewModel) { if (this.hasViewModel && this.viewModel) { this.viewModel.lazyCam = null; } this.viewModel = viewModel; this.hasViewModel = this.viewModel; if (this.hasViewModel) { this.viewModel.lazyCam = this; this.targetAngle = this.viewModel.lazyAngle; this.allow = true; } else { this.allow = false; } }
// Token: 0x060032BD RID: 12989 RVA: 0x000C00F0 File Offset: 0x000BE2F0 public virtual void Local_FireArrow(global::ViewModel vm, global::ItemRepresentation itemRep, global::IBowWeaponItem itemInstance, ref global::HumanController.InputSample sample) { if (vm) { vm.Play("fire_1", 0); } this.MakeReadyIn(itemInstance, this.fireRate); global::Character character = itemInstance.character; if (character == null) { return; } Ray eyesRay = character.eyesRay; Vector3 eyesOrigin = character.eyesOrigin; this.FireArrow(eyesOrigin, character.eyesRotation, itemRep, itemInstance); BitStream bitStream = new BitStream(false); bitStream.WriteVector3(eyesOrigin); bitStream.WriteQuaternion(character.eyesRotation); itemRep.ActionStream(1, 0, bitStream); }
// Token: 0x0600322D RID: 12845 RVA: 0x000BF384 File Offset: 0x000BD584 public void DoActualExtinguish(global::ItemRepresentation itemRep, global::IBasicTorchItem itemInstance, global::ViewModel vm) { if (itemInstance == null) { Debug.Log("inst null"); } if (itemRep == null) { Debug.Log("rep null"); } if (vm == null) { Debug.Log("vm null "); } itemInstance.Extinguish(); }
// Token: 0x0600322C RID: 12844 RVA: 0x000BF370 File Offset: 0x000BD570 public void DoActualIgnite(global::ItemRepresentation itemRep, global::IBasicTorchItem itemInstance, global::ViewModel vm) { this.Ignite(vm, itemRep, itemInstance); itemRep.Action(2, 0); }
// Token: 0x060035D0 RID: 13776 RVA: 0x000C4C10 File Offset: 0x000C2E10 public ModViewModelRemoveArgs(global::ViewModel vm, global::IHeldItem item, global::ItemModRepresentation modRep) { this.vm = vm; this.item = item; this.modRep = modRep; }
// Token: 0x060035D1 RID: 13777 RVA: 0x000C4C28 File Offset: 0x000C2E28 public ModViewModelRemoveArgs(global::ViewModel vm, global::IHeldItem item) { this = new global::ModViewModelRemoveArgs(vm, item, null); }
// Token: 0x060035CF RID: 13775 RVA: 0x000C4C04 File Offset: 0x000C2E04 public ModViewModelAddArgs(global::ViewModel vm, global::IHeldItem item, bool isMesh) { this = new global::ModViewModelAddArgs(vm, item, isMesh, null); }
// 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); } }
// Token: 0x0600353A RID: 13626 RVA: 0x000C3E1C File Offset: 0x000C201C public virtual void Local_MidSwing(global::ViewModel vm, global::ItemRepresentation itemRep, global::IMeleeWeaponItem itemInstance, ref global::HumanController.InputSample sample) { global::Character character = itemInstance.character; if (character == null) { return; } Ray eyesRay = character.eyesRay; Collider collider = null; Vector3 zero = Vector3.zero; Vector3 up = Vector3.up; global::NetEntityID netEntityID = global::NetEntityID.unassigned; bool flag = false; BodyPart bodyPart; bool flag2 = this.Physics2SphereCast(eyesRay, 0.3f, this.GetRange(), 406721553, out zero, out up, out collider, out bodyPart); bool flag3 = false; global::TakeDamage takeDamage = null; if (flag2) { IDBase idbase; global::TransformHelpers.GetIDBaseFromCollider(collider, out idbase); IDMain idmain = (!idbase) ? null : idbase.idMain; if (idmain) { netEntityID = global::NetEntityID.Get(idmain); flag = !netEntityID.isUnassigned; takeDamage = idmain.GetComponent <global::TakeDamage>(); if (takeDamage && takeDamage.ShouldPlayHitNotification()) { this.PlayHitNotification(zero, character); } } flag3 = collider.gameObject.CompareTag("Tree Collider"); if (flag3) { global::WoodBlockerTemp blockerForPoint = global::WoodBlockerTemp.GetBlockerForPoint(zero); if (!blockerForPoint.HasWood()) { flag3 = false; Rust.Notice.Popup("", "There's no wood left here", 2f); } else { blockerForPoint.ConsumeWood(this.efficiencies[2]); } } this.DoMeleeEffects(eyesRay.origin, zero, Quaternion.LookRotation(up), collider.gameObject); if (vm && (takeDamage || flag3)) { vm.CrossFade("pull_out", 0.05f, 0, 1.1f); } } BitStream bitStream = new BitStream(false); if (flag) { bitStream.WriteBoolean(flag); bitStream.Write <global::NetEntityID>(netEntityID, new object[0]); bitStream.WriteVector3(zero); } else { bitStream.WriteBoolean(false); bitStream.WriteVector3(zero); } bitStream.WriteBoolean(flag3); itemRep.ActionStream(1, 0, bitStream); this.EndSwingWorldAnimations(itemRep); }