コード例 #1
0
ファイル: SlowBall.cs プロジェクト: dargonesti/AsteroidsGame
        /// <summary>
        /// Si touche une cible, explose!
        /// </summary>
        public override void Die()
        {
            // 1 degree = 0.0174532925
            //degrees = radians * (180/ Pi)
            //360 Degree = radians *

            Laser laserTmp;
            float nbLance = 20;
            float angleRad = 0;

            for (int i = 0; i < nbLance; i++)
            {
                angleRad = (float)(i * Math.PI * 2 / nbLance);
                laserTmp = new Laser(this, false, 900);

                laserTmp.SpeedX = Laser.LASER_SPEED * (float)Math.Cos(angleRad);
                laserTmp.SpeedY = Laser.LASER_SPEED * (float)Math.Sin(angleRad);

                laserTmp.RotationInRadians = angleRad;

                _lstToAdd.Add(laserTmp);
            }
            IsAlive = false;

            SoundManager.Play(SoundManager.ShotGun);
        }
コード例 #2
0
ファイル: SlowBall.cs プロジェクト: dargonesti/AsteroidsGame
        public override void Update(GameTime gameTime)
        {
            base.Update(gameTime);
            _ttl -= gameTime.ElapsedGameTime.Milliseconds;
            if ((_ttlTotal - _ttl) / _timeBetweenProjectiles > _shotProjectiles)
            {
                Laser laserTmp;

                    laserTmp = new Laser(this, false, 1400);

                    laserTmp.SpeedX = Laser.LASER_SPEED / 2 * (float)Math.Cos(_degreTir);// +this.SpeedX; // pkmarche pas?????
                    laserTmp.SpeedY = Laser.LASER_SPEED / 2 * (float)Math.Sin(_degreTir);// +this.SpeedY;

                    laserTmp.RotationInRadians = _degreTir ;

                    _lstToAdd.Add(laserTmp);

                _degreTir += (float)Math.PI * 2f / 10f;
                _shotProjectiles++;
            }
        }