void IRequiresGun.InformOfGun(GunSettings settings)
        {
            gunSettings = settings;

            hitPool    = ObjectPooler.GetOrCreateObjectPool <PoolableParticleEffect>(gunSettings.ImpactEffect, 10);
            bulletPool = ObjectPooler.GetOrCreateObjectPool <PoolableLineRenderer>(gunSettings.BulletLineRenderer, 10);

            foreach (var component in recoilComponents)
            {
                component.SetRecoilSettings(gunSettings.HipRecoil, gunSettings.AimRecoil);
            }

            // The gun has changed, so reset the cached muzzleflash. (May not be ready yet, so get later)
            muzzleFlashNeedsRefresh = true;
        }
示例#2
0
        public void InformOfGun(GunSettings settings)
        {
            if (instantiatedGun != null)
            {
                Destroy(instantiatedGun);
            }

            // Instantiate at the socket, but keep its scale.
            instantiatedGun = Instantiate(settings.GunModel, gunSocket);
            instantiatedGun.transform.SetParent(gunSocket);
            instantiatedGun.transform.localPosition    = Vector3.zero;
            instantiatedGun.transform.localEulerAngles = Vector3.zero;

            Gun = instantiatedGun.GetComponent <GunHandle>();

            SetCollision();
            SetShadowMode();
        }
示例#3
0
 private void OnGunChanged(int gunId)
 {
     CurrentGunSettings = GunDictionary.Get(gunId);
     SetGunSettings();
 }
 public void InformOfGun(GunSettings settings)
 {
     gunSettings = settings;
 }