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 cPlayer(PlayerIndex playerIndex) { _friction = 0.2f; _playing = false; _lastKS = Keyboard.GetState(); _playerIndex = playerIndex; _lastGPS = GamePad.GetState(playerIndex); _collisionBounds = new Rectangle(-15, -15, 30, 30); _boundsCollision = true; _weaponSwitching = false; _currentWeaponIndex = 0; _firePointRight = 0; _firePointLeft = 0; _canWalk = true; _currentGrapple = null; _dJump = false; _score = 0; _reticuleAngle = 0; if (playerIndex == PlayerIndex.One) { _primaryColor = new Color(78, 164, 222); } if (playerIndex == PlayerIndex.Two) { _primaryColor = new Color(154, 222, 78); } if (playerIndex == PlayerIndex.Three) { _primaryColor = new Color(249, 157, 28); } if (playerIndex == PlayerIndex.Four) { _primaryColor = new Color(222, 78, 185); } Respawn(); }