public override void Throw() { if ((bool)detonating) { UseAmmo(); VoiceManager.Instance.Play("BKGS440_throw_2"); 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 gameObject = Object.Instantiate((Object)GetComponent <Weapon>().BulletOrBody, vector, base.transform.rotation) as GameObject; if (null != gameObject) { Rigidbody component = gameObject.GetComponent <Rigidbody>(); if (null != component) { component.AddForce(ray.direction * throwForce, ForceMode.Impulse); } PrjSmoke component2 = gameObject.GetComponent <PrjSmoke>(); if (null != component2) { component2.Index = base.CurAmmo; component2.DetonatorTime = detonatorTime; component2.ExplosionTime = explosionTime; component2.PersistTime = persistTime; } 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); if (RoomManager.Instance.CurrentRoomType == Room.ROOM_TYPE.BUNGEE) { GameObject gameObject2 = GameObject.Find("Me"); if (null != gameObject2) { LocalController component3 = gameObject2.GetComponent <LocalController>(); if (component3 != null) { component3.ReturnBuildGun(); } } } } } }
protected void UseAmmo() { curAmmo = NoCheat.Instance.UnhideVal(NoCheat.WATCH_DOG.MAIN_AMMO, curAmmo) - 1; if (curAmmo < 0) { curAmmo = 0; } curAmmo = NoCheat.Instance.HideVal(NoCheat.WATCH_DOG.MAIN_AMMO, curAmmo); NoCheat.Instance.Sync(NoCheat.WATCH_DOG.MAIN_AMMO, curAmmo); if (curAmmo == 0 && RoomManager.Instance.CurrentRoomType == Room.ROOM_TYPE.BUNGEE) { GameObject gameObject = GameObject.Find("Me"); if (null != gameObject) { LocalController component = gameObject.GetComponent <LocalController>(); if (component != null) { component.ReturnBuildGun(); } } } }