Exemplo n.º 1
0
        public Cannon(
            CannonConfig data,
            AudioSource source,
            Transform barrelTip,
            float shotVolume = 1.0f)
        {
            Description     = data.Description;
            _aimTime        = data.AimTime;
            _shotReload     = data.ShotReload;
            _salvoLength    = data.SalvoLength;
            _salvoRemaining = _salvoLength;
            _salvoReload    = data.SalvoReload;

            _audioSource = source;
            _shotVolume  = shotVolume;
            _barrelTip   = barrelTip;
            _random      = new System.Random(Environment.TickCount);
            _shellPrefab = Resources.Load <GameObject>("Shell");

            Ammo = new Ammo[data.Ammo.Count];
            for (int i = 0; i < data.Ammo.Count; i++)
            {
                Ammo[i] = new Ammo(data.Ammo[i], _barrelTip);

                if (Ammo[i].DamageType == DamageType.KE || Ammo[i].DamageType == DamageType.HEAT)
                {
                    _apRange = _apRange > Ammo[i].GroundRange ? _apRange : Ammo[i].GroundRange;
                }
            }

            HudIcon = data.WeaponSprite;
        }
Exemplo n.º 2
0
 public Cannon(
     CannonConfig data,
     AudioSource source,
     ParticleSystem shotEffect,
     AudioClip shotSound,
     ParticleSystem muzzleFlashEffect,
     float shotVolume = 1.0f)
 {
     _data              = data;
     _source            = source;
     _shotEffect        = shotEffect;
     _shotSound         = shotSound;
     _muzzleFlashEffect = muzzleFlashEffect;
     _shotVolume        = shotVolume;
     _random            = new System.Random(Environment.TickCount);
 }
Exemplo n.º 3
0
        public Cannon(
            CannonConfig data,
            AudioSource source,
            Transform barrelTip,
            float shotVolume = 1.0f)
        {
            _shotReload  = data.ShotReload;
            _salvoLength = data.SalvoLength;
            _salvoReload = data.SalvoReload;

            _audioSource = source;
            _shotVolume  = shotVolume;
            _barrelTip   = barrelTip;
            _random      = new System.Random(Environment.TickCount);
            _shellPrefab = Resources.Load <GameObject>("Shell");

            _ammo = new Ammo[data.Ammo.Count];
            for (int i = 0; i < data.Ammo.Count; i++)
            {
                _ammo[i] = new Ammo(data.Ammo[i], _barrelTip);
            }
        }