public bool SetCurrent(int slot) { if (slot < 0 || slot >= equipments.Length) { return(false); } if (equipments[slot] == null) { return(false); } WeaponFunction component = equipments[slot].GetComponent <WeaponFunction>(); if (null == component) { return(false); } if (slot == currentWeaponType) { return(false); } if (component.weaponBy == Weapon.BY.CLOCKBOMB && !MyInfoManager.Instance.AmIBlasting()) { return(false); } prevWeaponType = currentWeaponType; currentWeaponType = slot; WeaponChanger component2 = GetComponent <WeaponChanger>(); if (null != component2) { component2.Swap(); } return(true); }
private void CheckBoxmen() { HitPart[] array = ExplosionUtil.CheckBoxmen(base.transform.position, Radius, includeFriendly: false); for (int i = 0; i < array.Length; i++) { PlayerProperty[] allComponents = Recursively.GetAllComponents <PlayerProperty>(array[i].transform, includeInactive: false); if (allComponents.Length == 1) { int num = Mathf.FloorToInt(array[i].damageFactor * CalcPowFrom(array[i].transform.position)); if (num > 0) { WeaponFunction component = GetComponent <WeaponFunction>(); if (null == component) { Debug.LogError("wpnFunc == null"); } TWeapon tWeapon = (TWeapon)GetComponent <Weapon>().tItem; if (tWeapon == null) { Debug.LogError("wpn == null"); } Item item = MyInfoManager.Instance.GetItemBySequence(component.ItemSeq); if (item == null) { item = MyInfoManager.Instance.GetUsingEquipByCode(tWeapon.code); } num = GlobalVars.Instance.applyDurabilityDamage(item?.Durability ?? (-1), tWeapon.durabilityMax, num); P2PManager.Instance.SendPEER_BOMBED(MyInfoManager.Instance.Seq, allComponents[0].Desc.Seq, num, Rigidity, (int)weaponBy); } } } }
public void EquipSmokeBomb() { ChangeWeapon(Weapon.TYPE.PROJECTILE); WeaponFunction currentWeaponFunction = GetCurrentWeaponFunction(); if (currentWeaponFunction.weaponBy != Weapon.BY.KG440) { Equip component = currentWeapon.GetComponent <Equip>(); WeaponChange(component.tItem.code, "wal", -1); } }
private void Modify() { WeaponFunction component = GetComponent <WeaponFunction>(); if (null != component) { WpnMod wpnMod = WeaponModifier.Instance.Get((int)component.weaponBy); if (wpnMod != null) { maxAmmo = wpnMod.maxAmmo; explosionTime = wpnMod.explosionTime; speedFactor = wpnMod.fSpeedFactor; AtkPow = wpnMod.fAtkPow; Rigidity = wpnMod.fRigidity; throwForce = wpnMod.fThrowForce; Radius = wpnMod.radius; } WpnModEx ex = WeaponModifier.Instance.GetEx((int)component.weaponBy); if (ex != null) { persistTime = ex.persistTime; } TWeapon tWeapon = (TWeapon)GetComponent <Weapon>().tItem; Item item = MyInfoManager.Instance.GetItemBySequence(component.ItemSeq); if (item == null) { item = MyInfoManager.Instance.GetUsingEquipByCode(tWeapon.code); } if (item != null) { int num = 0; int grade = item.upgradeProps[num].grade; if (grade > 0) { float value = PimpManager.Instance.getValue((int)tWeapon.upgradeCategory, num, grade - 1); AtkPow += value; } num = 6; grade = item.upgradeProps[num].grade; if (grade > 0) { float value2 = PimpManager.Instance.getValue((int)tWeapon.upgradeCategory, num, grade - 1); throwForce += value2; } num = 7; grade = item.upgradeProps[num].grade; if (grade > 0) { float value3 = PimpManager.Instance.getValue((int)tWeapon.upgradeCategory, num, grade - 1); Radius += value3; } } } }
private void OnTriggerEnter2D(Collider2D other) { if (other.GetComponent <WeaponFunction>() != null) { if (other.GetComponent <WeaponFunction>().bullet != weapons[weaponIndex]) { WeaponFunction weapon = other.GetComponent <WeaponFunction>(); weapon.bullet = weapons[weaponIndex]; weapon.AddNewWeapon(weapons[weaponIndex]); Destroy(transform.parent.gameObject); } } }
public void EquipBrickBoom() { deltaTime = 0f; if (equipments[2] != null) { Object.DestroyImmediate(equipments[2]); } equipments[2] = Equip("BrickGun03"); WeaponFunction component = equipments[2].GetComponent <WeaponFunction>(); component.Reset(); SetCurrent(2); }
public void Initialize(GameObject[] usables) { slot2Key = new int[5] { 2, 1, 0, 3, 4 }; key2Slot = new Weapon.TYPE[5] { Weapon.TYPE.MAIN, Weapon.TYPE.AUX, Weapon.TYPE.MELEE, Weapon.TYPE.PROJECTILE, Weapon.TYPE.MODE_SPECIFIC }; deltaTime = float.PositiveInfinity; weapons = new Texture2D[usables.Length]; for (int i = 0; i < usables.Length; i++) { weapons[i] = null; } for (int j = 0; j < usables.Length; j++) { if (!(null == usables[j])) { Weapon component = usables[j].GetComponent <Weapon>(); if (!(null == component) && component.slot != Weapon.TYPE.COUNT) { WeaponFunction component2 = usables[j].GetComponent <WeaponFunction>(); if (!(null == component2)) { if (component2.weaponBy != Weapon.BY.COMPOSER) { weapons[slot2Key[(int)component.slot]] = TItemManager.Instance.GetWeaponBy((int)component2.weaponBy); } else { BrickComposer component3 = usables[j].GetComponent <BrickComposer>(); if (null != component3) { weapons[slot2Key[(int)component.slot]] = component3.icon; } } } } } } }
public void ReturnBuildGun() { deltaTime = 0f; SetCurrent(4); if (GlobalVars.Instance.StateFever <= 0) { WeaponFunction component = equipments[4].GetComponent <WeaponFunction>(); if (null != component) { P2PManager.Instance.SendPEER_STATE_FEVER(isOn: false); component.setFever(isOn: false); } } }
public void EquipSmokeBomb() { deltaTime = 0f; if (equipments[3] == null) { equipments[3] = Equip("kgs440"); } else { WeaponFunction component = equipments[3].GetComponent <WeaponFunction>(); component.Reset(); } SetCurrent(3); }
public bool PickupFromFromInstance(long itemSeq) { Item itemBySequence = MyInfoManager.Instance.GetItemBySequence(itemSeq); if (itemBySequence == null) { return(false); } TWeapon tWeapon = (TWeapon)itemBySequence.Template; if (tWeapon == null) { return(false); } Weapon.TYPE weaponType = tWeapon.GetWeaponType(); string code = tWeapon.code; HideWeapon(equipments[(int)weaponType]); Object.DestroyImmediate(equipments[(int)weaponType]); if (weaponType == Weapon.TYPE.MAIN && WeaponLeft != null) { Object.DestroyImmediate(WeaponLeft); WeaponLeft = null; } GameObject gameObject = Equip(code); if (null == gameObject) { return(false); } WeaponFunction component = gameObject.GetComponent <WeaponFunction>(); if (null == component) { return(false); } component.ItemSeq = itemSeq; equipments[(int)weaponType] = gameObject; prevWeaponType = -1; currentWeaponType = (int)weaponType; WeaponChanger component2 = GetComponent <WeaponChanger>(); if (null != component2) { component2.Initialize(equipments); } return(true); }
public Weapon.BY GetWeaponBY() { Weapon component = GetComponent <Weapon>(); if (null == component) { return(Weapon.BY.FALLOUT); } WeaponFunction component2 = component.GetComponent <WeaponFunction>(); if (component2 == null) { return(Weapon.BY.FALLOUT); } return(component2.weaponBy); }
private void UpdateWeaponHeldTime() { Weapon[] componentsInChildren = GetComponentsInChildren <Weapon>(includeInactive: true); if (componentsInChildren != null) { for (int i = 0; i < componentsInChildren.Length; i++) { WeaponFunction component = componentsInChildren[i].GetComponent <WeaponFunction>(); if (null != component && Weapon.TYPE.MELEE <= componentsInChildren[i].slot && componentsInChildren[i].slot <= Weapon.TYPE.PROJECTILE) { Item item = MyInfoManager.Instance.GetItemBySequence(component.ItemSeq); if (item == null) { item = MyInfoManager.Instance.GetUsingItemBySlot((TItem.SLOT)(componentsInChildren[i].slot + 2)); } if (item != null) { if (weaponHeldTime.ContainsKey(item.Seq)) { Dictionary <long,float> dictionary; Dictionary <long,float> dictionary2 = dictionary = weaponHeldTime; long seq; long key = seq = item.Seq; float num = dictionary[seq]; dictionary2[key] = num + componentsInChildren[i].FlushHeldTime(); } else { weaponHeldTime.Add(item.Seq,componentsInChildren[i].FlushHeldTime()); } } } } float num2 = 0f; foreach (KeyValuePair <long,float> item2 in weaponHeldTime) { num2 += item2.Value; } Dictionary <long,float> dictionary3 = new Dictionary <long,float>(); foreach (KeyValuePair <long,float> item3 in weaponHeldTime) { dictionary3.Add(item3.Key,(!(num2 <= 0f)) ? (item3.Value / num2) : 0f); } CSNetManager.Instance.Sock.SendCS_WEAPON_HELD_RATIO_REQ(dictionary3); } }
private void Modify() { WeaponFunction component = GetComponent <WeaponFunction>(); if (null != component) { WpnMod wpnMod = WeaponModifier.Instance.Get((int)component.weaponBy); if (wpnMod != null) { reloadSpeed = wpnMod.fReloadSpeed; drawSpeed = wpnMod.fDrawSpeed; range = wpnMod.fRange; effectiveRange = wpnMod.effectiveRange; brokenRatio = wpnMod.brokenRatio; } } }
private void Modify() { if (RoomManager.Instance.CurrentRoomType != Room.ROOM_TYPE.BUNGEE) { WeaponFunction component = GetComponent <WeaponFunction>(); if (null != component) { WpnMod wpnMod = WeaponModifier.Instance.Get((int)component.weaponBy); if (wpnMod != null) { maxAmmo = wpnMod.maxAmmo; explosionTime = wpnMod.explosionTime; speedFactor = wpnMod.fSpeedFactor; throwForce = wpnMod.fThrowForce; } WpnModEx ex = WeaponModifier.Instance.GetEx((int)component.weaponBy); if (ex != null) { persistTime = ex.persistTime; } TWeapon tWeapon = (TWeapon)GetComponent <Weapon>().tItem; Item item = MyInfoManager.Instance.GetItemBySequence(component.ItemSeq); if (item == null) { item = MyInfoManager.Instance.GetUsingEquipByCode(tWeapon.code); } if (item != null) { int num = 0; int grade = item.upgradeProps[num].grade; if (grade > 0) { float value = PimpManager.Instance.getValue((int)tWeapon.upgradeCategory, num, grade - 1); throwForce += value; } num = 8; grade = item.upgradeProps[num].grade; if (grade > 0) { float num2 = persistTime = PimpManager.Instance.getValue((int)tWeapon.upgradeCategory, num, grade - 1); } } } } }
public void EquipBrickBoom() { ChangeWeapon(Weapon.TYPE.MAIN); WeaponFunction currentWeaponFunction = GetCurrentWeaponFunction(); if (currentWeaponFunction.weaponBy != Weapon.BY.BRICK_BOOMER) { Equip component = currentWeapon.GetComponent <Equip>(); Unequip(component.tItem.code); GameObject gameObject = TItemManager.Instance.FindPrefab("BrickGun03"); if (null != gameObject && bungeeItemMain == null) { bungeeItemMain = (Object.Instantiate((Object)gameObject) as GameObject); bungeeItemMain.GetComponent <Weapon>().tItem = null; bungeeItemMain.GetComponent <WeaponGadget>().enabled = true; bungeeItemMain.GetComponent <WeaponFunction>().enabled = false; } } }
private bool FillAmmo(Weapon.TYPE weaponType,TWeapon tWeapon) { if (tWeapon == null || equipments[(int)weaponType] == null) { return(false); } if (null == tWeapon.CurPrefab()) { return(false); } WeaponFunction component = tWeapon.CurPrefab().GetComponent <WeaponFunction>(); WeaponFunction component2 = equipments[(int)weaponType].GetComponent <WeaponFunction>(); if (component.weaponBy != component2.weaponBy || component2.IsFullAmmo()) { return(false); } component2.Reset(); return(true); }
public void SwapWeapon(long itemSeq,string itemCode,int ammo,int ammo2) { TWeapon tWeapon = TItemManager.Instance.Get <TWeapon>(itemCode); if (tWeapon != null) { int weaponType = (int)tWeapon.GetWeaponType(); GlobalVars.Instance.DropWeapon(weaponType); HideWeapon(equipments[weaponType]); Object.DestroyImmediate(equipments[weaponType]); equipments[weaponType] = null; if (weaponType == 2 && WeaponLeft != null) { Object.DestroyImmediate(WeaponLeft); WeaponLeft = null; } GameObject gameObject = Equip(itemCode); WeaponFunction component = gameObject.GetComponent <WeaponFunction>(); if (!(null == component)) { component.ItemSeq = itemSeq; equipments[weaponType] = gameObject; prevWeaponType = -1; currentWeaponType = weaponType; WeaponChanger component2 = GetComponent <WeaponChanger>(); if (null != component2) { component2.Initialize(equipments); component2.Swap(); } GetComponent <LocalController>().SwitchWeapon(); GetComponent <LocalController>().ToIdle(); Gun component3 = equipments[weaponType].GetComponent <Gun>(); if (component3 != null) { component3.PickedAmmo = ammo; component3.PickedAmmo2 = ammo2; } } } }
private void Modify() { WeaponFunction component = GetComponent <WeaponFunction>(); if (null != component) { WpnMod wpnMod = WeaponModifier.Instance.Get((int)component.weaponBy); if (wpnMod != null) { accuracy.accuracy = wpnMod.fZAccuracy; accuracy.accurateMin = wpnMod.fZAccurateMin; accuracy.accurateMax = wpnMod.fZAccurateMax; accuracy.inaccurateMin = wpnMod.fZInaccurateMin; accuracy.inaccurateMax = wpnMod.fZInaccurateMax; accuracy.accurateSpread = wpnMod.fZAccurateSpread; accuracy.accurateCenter = wpnMod.fZAccurateCenter; accuracy.inaccurateSpread = wpnMod.fZInaccurateSpread; accuracy.inaccurateCenter = wpnMod.fZInaccurateCenter; accuracy.moveInaccuracyFactor = wpnMod.fZMoveInaccuracyFactor; fov = wpnMod.fZFov; camSpeed = wpnMod.fZCamSpeed; } TWeapon tWeapon = (TWeapon)GetComponent <Weapon>().tItem; Item item = MyInfoManager.Instance.GetItemBySequence(component.ItemSeq); if (item == null) { item = MyInfoManager.Instance.GetUsingEquipByCode(tWeapon.code); } if (item != null) { int num = 1; int grade = item.upgradeProps[num].grade; if (grade > 0) { float value = PimpManager.Instance.getValue((int)tWeapon.upgradeCategory, num, grade - 1); accuracy.accuracy += value; } } } }
private void CheckBoxmen(Vector3 boomPos) { HitPart[] array = ExplosionUtil.CheckBoxmen(boomPos, Radius, includeFriendly: false); for (int i = 0; i < array.Length; i++) { PlayerProperty[] allComponents = Recursively.GetAllComponents <PlayerProperty>(array[i].transform, includeInactive: false); if (allComponents.Length == 1) { int num = Mathf.FloorToInt(array[i].damageFactor * CalcPowFrom(boomPos, array[i].transform.position)); if (num > 0) { WeaponFunction component = GetComponent <WeaponFunction>(); if (null == component) { Debug.LogError("wpnFunc == null"); } TWeapon tWeapon = (TWeapon)GetComponent <Weapon>().tItem; if (tWeapon == null) { Debug.LogError("wpn == null"); } Item usingEquipByCode = MyInfoManager.Instance.GetUsingEquipByCode(tWeapon.code); num = GlobalVars.Instance.applyDurabilityDamage(usingEquipByCode?.Durability ?? (-1), tWeapon.durabilityMax, num); allComponents[0].Desc.accumDamaged += num; } } } GameObject[] array2 = BrickManManager.Instance.ToGameObjectArray(); for (int j = 0; j < array2.Length; j++) { PlayerProperty component2 = array2[j].GetComponent <PlayerProperty>(); if (null != component2 && component2.Desc.accumDamaged > 0) { P2PManager.Instance.SendPEER_BOMBED(MyInfoManager.Instance.Seq, component2.Desc.Seq, component2.Desc.accumDamaged, Rigidity, (int)weaponBy); component2.Desc.accumDamaged = 0; realExplosion = true; } } }
private void Modify() { WeaponFunction component = GetComponent <WeaponFunction>(); if (null != component) { WpnMod wpnMod = WeaponModifier.Instance.Get((int)component.weaponBy); if (wpnMod != null) { speedFactor = wpnMod.fSpeedFactor; AtkPow = wpnMod.fAtkPow; Rigidity = wpnMod.fRigidity; slashSpeed = wpnMod.fSlashSpeed; } TWeapon tWeapon = (TWeapon)GetComponent <Weapon>().tItem; Item item = MyInfoManager.Instance.GetItemBySequence(component.ItemSeq); if (item == null) { item = MyInfoManager.Instance.GetUsingEquipByCode(tWeapon.code); } if (item != null) { int num = 0; int grade = item.upgradeProps[num].grade; if (grade > 0) { float value = PimpManager.Instance.getValue((int)tWeapon.upgradeCategory, num, grade - 1); AtkPow += value; } num = 5; grade = item.upgradeProps[num].grade; if (grade > 0) { float value2 = PimpManager.Instance.getValue((int)tWeapon.upgradeCategory, num, grade - 1); slashSpeed += value2; } } } }
private void ParseWeapon(CSVLoader csvLoader) { for (int i = 0; i < csvLoader.Rows; i++) { csvLoader.ReadValue(0, i, string.Empty, out string Value); csvLoader.ReadValue(1, i, string.Empty, out string Value2); csvLoader.ReadValue(2, i, string.Empty, out string Value3); csvLoader.ReadValue(3, i, string.Empty, out string Value4); csvLoader.ReadValue(4, i, string.Empty, out string Value5); csvLoader.ReadValue(5, i, string.Empty, out string Value6); csvLoader.ReadValue(6, i, string.Empty, out string Value7); csvLoader.ReadValue(7, i, string.Empty, out string Value8); csvLoader.ReadValue(8, i, def: true, out bool Value9); csvLoader.ReadValue(9, i, string.Empty, out string Value10); csvLoader.ReadValue(10, i, string.Empty, out string Value11); csvLoader.ReadValue(11, i, string.Empty, out string Value12); csvLoader.ReadValue(12, i, string.Empty, out string Value13); csvLoader.ReadValue(13, i, string.Empty, out string Value14); csvLoader.ReadValue(14, i, def: false, out bool Value15); csvLoader.ReadValue(15, i, string.Empty, out string Value16); csvLoader.ReadValue(16, i, -1, out int Value17); csvLoader.ReadValue(17, i, string.Empty, out string Value18); csvLoader.ReadValue(18, i, def: false, out bool Value19); csvLoader.ReadValue(19, i, string.Empty, out string Value20); csvLoader.ReadValue(20, i, string.Empty, out string Value21); csvLoader.ReadValue(21, i, string.Empty, out string Value22); csvLoader.ReadValue(22, i, string.Empty, out string Value23); csvLoader.ReadValue(23, i, def: false, out bool Value24); csvLoader.ReadValue(24, i, 100, out int Value25); Value8 = Value8.Trim(); Value8 = Value8.ToLower(); Value.Trim(); Value.ToLower(); Value2.Trim(); Value3.Trim(); Value4.Trim(); Value5.Trim(); Value5.ToLower(); Value6.Trim(); Value6.ToLower(); Value7.Trim(); Value7.ToLower(); Value10.Trim(); Value11.Trim(); Value12.Trim(); Value13.Trim(); Value14.Trim(); Value20.Trim(); Value21.Trim(); Value22.Trim(); Value23.Trim(); Value18 = Value18.ToLower(); int num = TItem.String2Type(Value5); int ck = TItem.String2Kind(num, Value6); int num2 = TWeapon.String2WeaponCategory(Value8); int upCat = TItem.String2UpgradeCategory(Value18); TWeapon tWeapon = new TWeapon(Value, Value2, Value12, FindPrefab(Value10), FindPrefab(Value11), FindIcon(Value3), FindIcon(Value4), num, ck, num2, Value9, TItem.String2Slot(Value7), Value13, BuffManager.Instance.Get(Value14), Value15, Value16, Value17, upCat, Value19, Convert.ToInt32(Value20), Value21, Value22, Value23, Value24, Value25); Add(Value, tWeapon); if (tWeapon.CurPrefab() != null) { WeaponFunction component = tWeapon.CurPrefab().GetComponent <WeaponFunction>(); Gun gun = tWeapon.CurPrefab().GetComponent <Gun>(); if (null == component) { Debug.LogError(Value + " weapon does not have WeaponFunction"); } else { if (!wpnBy2Slot.ContainsKey((int)component.weaponBy)) { wpnBy2Slot.Add((int)component.weaponBy, (int)tWeapon.slot); } if (!wpnBy2Category.ContainsKey((int)component.weaponBy)) { wpnBy2Category.Add((int)component.weaponBy, num2); } } } } }
public override void Throw() { if ((bool)detonating) { UseAmmo(); GameObject gameObject = GameObject.Find("Me"); if (gameObject != null) { LocalController component = gameObject.GetComponent <LocalController>(); if (component != null) { component.IDidSomething(); } } VoiceManager.Instance.Play("BKG400_throw_5"); Ray ray = cam.ScreenPointToRay(new Vector3((float)(Screen.width / 2), (float)(Screen.height / 2), 0f)); Vector3 vector = ray.origin + Vector3.up * 0.5f; Vector3 eulerAngles = base.transform.rotation.eulerAngles; GameObject gameObject2 = Object.Instantiate((Object)GetComponent <Weapon>().BulletOrBody, vector, base.transform.rotation) as GameObject; if (null != gameObject2) { Rigidbody component2 = gameObject2.GetComponent <Rigidbody>(); if (null != component2) { component2.AddForce(ray.direction * throwForce, ForceMode.Impulse); } PrjGrenade component3 = gameObject2.GetComponent <PrjGrenade>(); if (null != component3) { WeaponFunction component4 = GetComponent <WeaponFunction>(); if (component4 == null) { Debug.LogError("wpnfunc == null"); } TWeapon tWeapon = (TWeapon)GetComponent <Weapon>().tItem; if (tWeapon == null) { Debug.LogError("wpn == null"); } Item item = MyInfoManager.Instance.GetItemBySequence(component4.ItemSeq); if (item == null) { item = MyInfoManager.Instance.GetUsingEquipByCode(tWeapon.code); } component3.Index = base.CurAmmo; component3.AtkPow = CalcAtkPow(); component3.Rigidity = Rigidity; component3.WeaponBy = weaponBy; component3.WeaponByForChild = weaponByForChild; component3.Radius = Radius; component3.Durability = (item?.Durability ?? (-1)); component3.DurabilityMax = tWeapon.durabilityMax; component3.ApplyUsk = applyUsk; component3.DetonatorTime = detonatorTime; component3.ExplosionTime = explosionTime; } P2PManager.Instance.SendPEER_PROJECTILE(MyInfoManager.Instance.Seq, base.CurAmmo, vector, eulerAngles); } detonating = false; ShowGrenade(body: false, clip: false); if (base.CurAmmo <= 0) { P2PManager.Instance.SendPEER_ENABLE_HANDBOMB(MyInfoManager.Instance.Seq, enable: false); } } }
public Weapon.BY GetCurrentWeaponBy() { WeaponFunction component = equipments[CurrentWeapon].GetComponent <WeaponFunction>(); return(component.weaponBy); }
public override void Throw(int index, Vector3 initPos, Vector3 pos, Vector3 rot, bool bSoundvoc, bool IsYang) { Weapon component = GetComponent <Weapon>(); if (!(null == component) && dic != null && !dic.ContainsKey(index)) { GameObject gameObject = Object.Instantiate((Object)component.BulletOrBody, initPos, Quaternion.Euler(rot)) as GameObject; if (null != gameObject) { if (BuildOption.Instance.Props.useUskWeaponTex && applyUsk) { MeshRenderer[] componentsInChildren = gameObject.GetComponentsInChildren <MeshRenderer>(); foreach (MeshRenderer meshRenderer in componentsInChildren) { if (meshRenderer.material.mainTexture != null && UskManager.Instance.Get(meshRenderer.material.mainTexture.name) != null) { meshRenderer.material.mainTexture = UskManager.Instance.Get(meshRenderer.material.mainTexture.name); } } } if (bSoundvoc) { WeaponFunction component2 = component.GetComponent <WeaponFunction>(); if (component2 != null) { if (!IsYang) { if (component2.weaponBy == Weapon.BY.GRENADE || component2.weaponBy == Weapon.BY.KG400) { VoiceManager.Instance.Play0("BKG400_throw_5"); } else if (component2.weaponBy == Weapon.BY.KG440) { VoiceManager.Instance.Play0("BKGS440_throw_2"); } else if (component2.weaponBy == Weapon.BY.FLASHBANG) { VoiceManager.Instance.Play0("KG409_throw_3"); } else { VoiceManager.Instance.Play0("BKG400_throw_5"); } } else if (component2.weaponBy == Weapon.BY.GRENADE || component2.weaponBy == Weapon.BY.KG400) { VoiceManager.Instance.Play2("BKG400_throw_5"); } else if (component2.weaponBy == Weapon.BY.KG440) { VoiceManager.Instance.Play2("BKGS440_throw_2"); } else if (component2.weaponBy == Weapon.BY.FLASHBANG) { VoiceManager.Instance.Play2("KG409_throw_3"); } else { VoiceManager.Instance.Play2("BKG400_throw_5"); } } } Rigidbody component3 = gameObject.GetComponent <Rigidbody>(); if (null != component3) { component3.isKinematic = true; } Projectile component4 = gameObject.GetComponent <Projectile>(); if (null != component4) { component4.enabled = false; } dic.Add(index, new ProjectileWrap(gameObject)); } } }
private void CheckSlash() { if (isValidRange) { int layerMask = (1 << LayerMask.NameToLayer("Chunk")) | (1 << LayerMask.NameToLayer("Brick")) | (1 << LayerMask.NameToLayer("BoxMan")) | (1 << LayerMask.NameToLayer("Mon")) | (1 << LayerMask.NameToLayer("InvincibleArmor")) | (1 << LayerMask.NameToLayer("Bomb")) | (1 << LayerMask.NameToLayer("InstalledBomb")); Ray ray = cam.ScreenPointToRay(new Vector3((float)(Screen.width / 2), (float)(Screen.height / 2), 0f)); if (Physics.Raycast(ray, out RaycastHit hitInfo, GetComponent <Weapon>().range, layerMask)) { GameObject gameObject = null; GameObject gameObject2 = hitInfo.transform.gameObject; if (gameObject2.layer == LayerMask.NameToLayer("Chunk") || gameObject2.layer == LayerMask.NameToLayer("Brick")) { BrickProperty brickProperty = null; GameObject gameObject3 = null; if (gameObject2.layer == LayerMask.NameToLayer("Brick")) { BrickProperty[] allComponents = Recursively.GetAllComponents <BrickProperty>(gameObject2.transform, includeInactive: false); if (allComponents.Length > 0) { brickProperty = allComponents[0]; } } else { gameObject = BrickManager.Instance.GetBrickObjectByPos(Brick.ToBrickCoord(hitInfo.normal, hitInfo.point)); if (null != gameObject) { brickProperty = gameObject.GetComponent <BrickProperty>(); } } if (null != brickProperty) { P2PManager.Instance.SendPEER_HIT_BRICK(brickProperty.Seq, brickProperty.Index, hitInfo.point, hitInfo.normal, isBullet: false); gameObject3 = BrickManager.Instance.GetBulletImpact(brickProperty.Index); Brick brick = BrickManager.Instance.GetBrick(brickProperty.Index); if (brick != null && brick.destructible) { brickProperty.Hit((int)CalcAtkPow()); if (brickProperty.HitPoint <= 0) { if (!Application.loadedLevelName.Contains("Tutor")) { CSNetManager.Instance.Sock.SendCS_DESTROY_BRICK_REQ(brickProperty.Seq); } gameObject3 = null; if (brickProperty.Index == 115 || brickProperty.Index == 193) { CheckMyself(gameObject.transform.position, GlobalVars.Instance.BoomRadius); CheckBoxmen(gameObject.transform.position, GlobalVars.Instance.BoomRadius); CheckMonster(gameObject.transform.position, GlobalVars.Instance.BoomRadius); CheckDestructibles(gameObject.transform.position, GlobalVars.Instance.BoomRadius); } } else { P2PManager.Instance.SendPEER_BRICK_HITPOINT(brickProperty.Seq, brickProperty.HitPoint); } } } if (null != gameObject3) { Object.Instantiate((Object)gameObject3, hitInfo.point, Quaternion.FromToRotation(Vector3.up, hitInfo.normal)); } } else if (gameObject2.layer == LayerMask.NameToLayer("BoxMan")) { PlayerProperty[] allComponents2 = Recursively.GetAllComponents <PlayerProperty>(gameObject2.transform, includeInactive: false); TPController[] allComponents3 = Recursively.GetAllComponents <TPController>(gameObject2.transform, includeInactive: false); if (allComponents2.Length != 1) { Debug.LogError("PlayerProperty should be unique for a box man, but it has multiple PlayerProperty components or non "); } if (allComponents3.Length != 1) { Debug.LogError("TPController should be unique for a box man, but it has multiple TPController components or non "); } PlayerProperty playerProperty = null; TPController tPController = null; if (allComponents2.Length > 0) { playerProperty = allComponents2[0]; } if (allComponents3.Length > 0) { tPController = allComponents3[0]; } if (playerProperty != null && tPController != null) { int num = 0; HitPart component = gameObject2.GetComponent <HitPart>(); if (component != null) { if (component.GetHitImpact() != null) { Object.Instantiate((Object)component.GetHitImpact(), hitInfo.point, Quaternion.Euler(0f, 0f, 0f)); } num = (int)(CalcAtkPow() * component.damageFactor); if (!playerProperty.IsHostile()) { num = 0; } WeaponFunction component2 = GetComponent <WeaponFunction>(); if (null == component2) { Debug.LogError("wpnFunc == nulll"); } TWeapon tWeapon = (TWeapon)GetComponent <Weapon>().tItem; if (tWeapon == null) { Debug.LogError("wpn == null"); } Item item = MyInfoManager.Instance.GetItemBySequence(component2.ItemSeq); if (item == null) { item = MyInfoManager.Instance.GetUsingEquipByCode(tWeapon.code); } num = GlobalVars.Instance.applyDurabilityDamage(item?.Durability ?? (-1), tWeapon.durabilityMax, num); P2PManager.Instance.SendPEER_HIT_BRICKMAN(MyInfoManager.Instance.Seq, playerProperty.Desc.Seq, (int)component.part, hitInfo.point, hitInfo.normal, lucky: false, 0, ray.direction); P2PManager.Instance.SendPEER_PIERCE(MyInfoManager.Instance.Seq, playerProperty.Desc.Seq, num, Rigidity, (int)weaponBy); } tPController.GetHit(num, playerProperty.Desc.Seq); } } else if (gameObject2.layer == LayerMask.NameToLayer("Mon")) { MonProperty[] allComponents4 = Recursively.GetAllComponents <MonProperty>(gameObject2.transform, includeInactive: false); MonProperty monProperty = null; if (allComponents4.Length > 0) { monProperty = allComponents4[0]; } if (monProperty != null) { HitPart component3 = gameObject2.GetComponent <HitPart>(); if (component3 != null) { if ((MyInfoManager.Instance.Slot < 4 && monProperty.Desc.bRedTeam) || (MyInfoManager.Instance.Slot >= 4 && !monProperty.Desc.bRedTeam)) { return; } if (component3.GetHitImpact() != null) { Object.Instantiate((Object)component3.GetHitImpact(), hitInfo.point, Quaternion.Euler(0f, 0f, 0f)); } if (monProperty.Desc.Xp <= 0) { return; } int num2 = (int)(CalcAtkPow() * component3.damageFactor); if (monProperty.Desc.bHalfDamage) { num2 /= 2; } MonManager.Instance.Hit(monProperty.Desc.Seq, num2, 0f, (int)weaponBy, Vector3.zero, Vector3.zero, -1); } } } else if (gameObject2.layer == LayerMask.NameToLayer("InvincibleArmor") || gameObject2.layer == LayerMask.NameToLayer("Bomb") || gameObject2.layer == LayerMask.NameToLayer("InstalledBomb")) { GameObject impact = VfxOptimizer.Instance.GetImpact(gameObject2.layer); if (null != impact) { Object.Instantiate((Object)impact, hitInfo.point, Quaternion.FromToRotation(Vector3.up, hitInfo.normal)); P2PManager.Instance.SendPEER_HIT_IMPACT(gameObject2.layer, hitInfo.point, hitInfo.normal); } } isValidRange = false; } } }