Beispiel #1
0
        private void Fire()
        {
            if (_ammo.Count >= MaxRounds)
            {
                return;
            }
            var shot = new AmmoRound {
                Model = _sphere
            };
            var firingPoint = new Vector3(0, 1.5f, 0.0f);

            switch (_currentShotType)
            {
            case ShotType.Pistol:
                shot.Particle = new Particle(firingPoint,
                                             new Vector3(0, 0, 35), // 35 m/s
                                             new Vector3(0, -1, 0), // small amount of gravity
                                             2.0f                   // 2 kg
                                             )
                {
                    Damping = 0.99f
                };
                break;

            case ShotType.Artillery:
                shot.Particle = new Particle(
                    firingPoint,
                    new Vector3(0, 30, 40), // 50 m/s
                    new Vector3(0, -20, 0), // large amount of gravity
                    200.0f                  // 200 kg
                    )
                {
                    Damping = 0.99f
                };
                break;

            case ShotType.Fireball:
                shot.Particle = new Particle(
                    firingPoint,
                    new Vector3(0, 0, 10),   // 10 m/s
                    new Vector3(0, 0.6f, 0), // float up slightly
                    1.0f                     // 1 kg
                    )
                {
                    Damping = 0.9f
                };
                break;

            case ShotType.Laser:
                shot.Particle = new Particle(
                    firingPoint,
                    new Vector3(0, 0, 100), // 100 m/s
                    new Vector3(0, 0, 0),   // no gravity
                    0.1f                    // 100 grams
                    )
                {
                    Damping = 0.99f
                };
                break;
            }

            shot.Particle.Position = firingPoint;
            shot.StartTime         = Timer.TotalTime;
            shot.ShotType          = _currentShotType;

            shot.Particle.ClearAccumulator();

            _ammo.Add(shot);
        }
Beispiel #2
0
        public void Fire()
        {
            if (_ammo.Count >= MaxRounds)
                return;
            var shot = new AmmoRound() { Model = _sphere };

            switch (_currentShotType) {
                case ShotType.Pistol:
                    shot.Particle = new Particle() { Mass = 2.0f, Velocity = new Vector3(0, 0, 35), Acceleration = new Vector3(0, -1, 0), Damping = 0.99f };
                    break;
                case ShotType.Artillery:
                    shot.Particle = new Particle() { Mass = 200.0f, Velocity = new Vector3(0, 30, 40), Acceleration = new Vector3(0, -20, 0), Damping = 0.99f };
                    break;
                case ShotType.Fireball:
                    shot.Particle = new Particle() { Mass = 1.0f, Velocity = new Vector3(0, 0, 10), Acceleration = new Vector3(0, 0.6f, 0), Damping = 0.9f };
                    break;
                case ShotType.Laser:
                    shot.Particle = new Particle() { Mass = 0.1f, Velocity = new Vector3(0, 0, 100), Acceleration = new Vector3(0, 0, 0), Damping = 0.99f };
                    break;
            }
            shot.Particle.Position = new Vector3(0, 1.5f, 0.0f);
            shot.StartTime = Timer.TotalTime;
            shot.ShotType = _currentShotType;

            shot.Particle.ClearAccumulator();

            _ammo.Add(shot);
        }
Beispiel #3
0
        private void Fire() {
            if (_ammo.Count >= MaxRounds)
                return;
            var shot = new AmmoRound { Model = _sphere };
            var firingPoint = new Vector3(0, 1.5f, 0.0f);
            switch (_currentShotType) {
                case ShotType.Pistol:
                    shot.Particle = new Particle(firingPoint,
                        new Vector3(0, 0, 35), // 35 m/s
                        new Vector3(0, -1, 0), // small amount of gravity
                        2.0f // 2 kg
                        ) { Damping = 0.99f };
                    break;
                case ShotType.Artillery:
                    shot.Particle = new Particle(
                        firingPoint,
                        new Vector3(0, 30, 40), // 50 m/s
                        new Vector3(0, -20, 0), // large amount of gravity
                        200.0f // 200 kg
                        ) { Damping = 0.99f };
                    break;
                case ShotType.Fireball:
                    shot.Particle = new Particle(
                        firingPoint,
                        new Vector3(0, 0, 10), // 10 m/s
                        new Vector3(0, 0.6f, 0), // float up slightly
                        1.0f // 1 kg
                        ) { Damping = 0.9f };
                    break;
                case ShotType.Laser:
                    shot.Particle = new Particle(
                        firingPoint,
                        new Vector3(0, 0, 100), // 100 m/s
                        new Vector3(0, 0, 0),  // no gravity
                        0.1f // 100 grams
                        ) { Damping = 0.99f };
                    break;
            }

            shot.Particle.Position = firingPoint;
            shot.StartTime = Timer.TotalTime;
            shot.ShotType = _currentShotType;

            shot.Particle.ClearAccumulator();

            _ammo.Add(shot);
        }