public void Fire(bool grapple, float velocity) { cWeapon wep; if (grapple) { if (_currentGrapple == null) { Vector2 v = new Vector2((float)Math.Cos(_reticuleAngle), (float)Math.Sin(_reticuleAngle)); _currentGrapple = PrimalDevistation.Instance.Weapons.SpawnGrapple(this, _position + (v * 30), v * (16 * velocity)); } else { PrimalDevistation.Instance.Weapons.ReleaseGrapple(_currentGrapple); _currentGrapple = null; } } else { if (_currentAmmoLevels[_currentWeaponIndex, 2] <= _currentAmmoLevels[_currentWeaponIndex, 3]) { return; } if (_currentAmmoLevels[_currentWeaponIndex, 4] >= _currentAmmoLevels[_currentWeaponIndex, 5]) { _currentAmmoLevels[_currentWeaponIndex, 2] = 0; _currentAmmoLevels[_currentWeaponIndex, 0]--; if (_currentAmmoLevels[_currentWeaponIndex, 0] <= 0) { _currentAmmoLevels[_currentWeaponIndex, 4] = 0; _currentAmmoLevels[_currentWeaponIndex, 0] = _currentAmmoLevels[_currentWeaponIndex, 1]; } wep = PrimalDevistation.Instance.Weapons.WeaponBlueprints[_currentWeaponIndex]; Vector2 v = new Vector2((float)Math.Cos(_reticuleAngle), (float)Math.Sin(_reticuleAngle)); PrimalDevistation.Instance.Weapons.SpawnWeapon(wep, _position + (v * 30), v * (8 * velocity) + Velocity, this); cParticle p = new cParticle(); p.Texture = _muzzleFlash; p.MaxAge = 100; p.Position = _position + (v * 30); p.StartColor = Color.White; p.EndColor = Color.TransparentWhite; PrimalDevistation.Instance.ParticleEffectSystem.Particles.Add(p); } } }
public void updateTrail(GameTime gameTime) { cParticle p = new cParticle(); p.Texture = _trailTexture; Vector2 velTmp = new Vector2(_velocity.X, _velocity.Y); velTmp.Normalize(); velTmp *= -_texture.Width; p.Position = new Vector2(_position.X + velTmp.X, _position.Y + velTmp.Y); p.Velocity = new Vector2(cMath.Rand(-0.3f, 0.3f), cMath.Rand(-0.3f, 0.3f)); p.StartColor = Color.White; p.EndColor = Color.TransparentWhite; PrimalDevistation.Instance.ParticleEffectSystem.Particles.Add(p); }
public void Explode(int size, Vector2 where, Vector2 direction, cPlayer owner, bool audio) { Level.AddExplosion(size, where, direction); AddForce(where, -(size / 64f), size * 2); PlayerManager.Explosion(where, size, direction, owner); cParticle p = new cParticle(); if (size == 32) { p.Texture = _expFlash32; p.MaxAge = 100; } else if (size == 64) { p.Texture = _expFlash64; p.MaxAge = 300; } else if (size == 128) { p.Texture = _expFlash128; p.MaxAge = 500; } p.Position = where; p.StartColor = new Color(255, 255, 255, 255); p.EndColor = new Color(255, 0, 0, 0); ParticleEffectSystem.Particles.Add(p); if (audio) { if (size == 32) { PrimalDevistation.Instance.Audio.play("EXPLOSION_LARGE1"); } if (size == 64) { PrimalDevistation.Instance.Audio.play("EXPLOSION_LARGE2"); } if (size == 128) { PrimalDevistation.Instance.Audio.play("EXPLOSION_LARGE3"); } } }