Beispiel #1
0
        public AddMuffler(IWeapon weapon, DataWeapon dataWeapon, Transform playerTransform) : base(weapon)
        {
            _playerTransform = playerTransform;
            var muffler = new Muffler(dataWeapon.OneShotMufflerAudioClip, playerTransform, dataWeapon.MufflerPrefab, dataWeapon.ShotVolumeMuffler);

            _mufflerGO = Object.Instantiate(muffler.MufflerInstance, playerTransform.Find("Barrel").position, playerTransform.rotation);
            _mufflerGO.transform.parent = playerTransform;
        }
Beispiel #2
0
        private void SetResetMuffler(Data data, Transform playerTranform, IWeapon weapon)
        {
            if (!isMuffler)
            {
                isMuffler = !isMuffler;

                var muffler = new Muffler(data.Weapon.OneShotMufflerAudioClip, playerTranform, data.Weapon.MufflerPrefab, data.Weapon.ShotVolumeMuffler);
                _modificationWeapon = new ModificationMuffler(data.Weapon, muffler, playerTranform);
                _modificationWeapon.ApplyModification(weapon);
            }

            else if (isMuffler)
            {
                isMuffler = !isMuffler;
                _modificationWeapon.CancelModification(weapon);
            }
        }