示例#1
0
        private void BWUtil_OnFire(Gun obj)
        {
            BulletObject bobj = obj.chamberedBulletGameObject.GetComponent <BulletObject>();

            try
            {
                AmmoVariables bObj = new AmmoVariables();
                bObj.AttackDamage   = 1;
                bObj.ProjectileMass = 1;
                bObj.ExitVelocity   = 1;
                if (obj.chamberedCartridge != null)
                {
                    bObj = obj.chamberedCartridge.ammoVariables;
                }
                else if (obj.overrideMagazine != null)
                {
                    bObj = obj.overrideMagazine.AmmoSlots[0].ammoVariables;
                }
                GunFireMessage gfm = new GunFireMessage()
                {
                    handedness        = (byte)obj.host.GetHand(0).handedness,
                    firepointPos      = obj.firePointTransform.position,
                    firepointRotation = obj.firePointTransform.rotation,
                    ammoDamage        = bObj.AttackDamage,
                    projectileMass    = bObj.ProjectileMass,
                    exitVelocity      = bObj.ExitVelocity,
                    muzzleVelocity    = obj.muzzleVelocity
                };

                SendToServer(gfm.MakeMsg(), MessageSendType.Reliable);
            }
            catch
            {
            }
        }
示例#2
0
        private void BWUtil_OnFire(Gun obj)
        {
            BulletObject   bobj = obj.chamberedBulletGameObject.GetComponent <BulletObject>();
            GunFireMessage gfm  = new GunFireMessage()
            {
                fireDirection = obj.firePointTransform.forward,
                fireOrigin    = obj.firePointTransform.position,
                bulletDamage  = bobj.ammoVariables.AttackDamage
            };

            SendToServer(gfm.MakeMsg(), MessageSendType.Reliable);
        }