public void Ignite(ViewModel vm, ItemRepresentation itemRep, IBasicTorchItem torchItem) { if (torchItem != null) { torchItem.Ignite(); } bool flag = vm != null; GameObject obj2 = null; if (flag) { Socket.Slot slot = vm.socketMap["muzzle"]; obj2 = slot.socket.InstantiateAsChild(this.FirstPersonLightPrefab, false); if (torchItem != null) { torchItem.light = obj2; } } else if (((torchItem == null) || (torchItem.light == null)) && (!itemRep.networkView.isMine || actor.forceThirdPerson)) { if (this.ThirdPersonLightPrefab != null) { ((BasicTorchItemRep)itemRep)._myLightPrefab = this.ThirdPersonLightPrefab; } ((BasicTorchItemRep)itemRep).RepIgnite(); if ((((BasicTorchItemRep)itemRep)._myLight != null) && (torchItem != null)) { torchItem.light = ((BasicTorchItemRep)itemRep)._myLight; } } }
public void Ignite(ViewModel vm, ItemRepresentation itemRep, ITorchItem torchItem) { if (torchItem != null) { torchItem.Ignite(); } bool flag = vm != null; GameObject gameObject = null; if (flag) { this.StrikeSound.Play(); Socket.Slot item = vm.socketMap["muzzle"]; gameObject = item.socket.InstantiateAsChild(this.FirstPersonLightPrefab, false); if (torchItem != null) { torchItem.light = gameObject; } } else if ((torchItem == null || !torchItem.light) && (!itemRep.networkView.isMine || actor.forceThirdPerson)) { if (this.ThirdPersonLightPrefab) { ((TorchItemRep)itemRep)._myLightPrefab = this.ThirdPersonLightPrefab; } ((TorchItemRep)itemRep).RepIgnite(); if (((TorchItemRep)itemRep)._myLight && torchItem != null) { torchItem.light = ((TorchItemRep)itemRep)._myLight; } } }
public Socket GetSocketByName(Socket.Mapped vm, string name) { Socket.Slot slot = vm.socketMap[name]; return(slot.socket); }
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); }