Пример #1
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="origin"></param>
 /// <param name="destination"></param>
 /// <param name="newbullet">
 /// <remarks>Make sure that the newbullet has the correct playernumber</remarks></param>
 public void shootbullet(Vector2 origin, Vector2 destination, bullet newbullet)
 {
     bullet rbullet = bullets.unitpool.Retrieve().Item;
     rbullet.clone(newbullet);
     rbullet.body.Position = origin;
     rbullet.startinglocation = origin;
     rbullet.add(physics);
     Vector2 direction = Vector2.Normalize(Vector2.Subtract(destination, origin));
     rbullet.body.ApplyForce( direction * rbullet.getShootingSpeed());
     rbullet.rotationV2 = direction;
     triggerparticles("effect", origin);
     //SoundManager.PlaySound(rbullet.shootingsound);
 }
Пример #2
0
 public void ShootBullet(bullet bulletToClone, Vector2 startingLocation, Vector2 aimDirection)
 {
     bullet newBullet = bullets.unitpool.Retrieve().Item;
     newBullet.clone(bulletToClone);
     newBullet.position = startingLocation;
     newBullet.startinglocation = startingLocation;
     newBullet.add(physics);
     newBullet.body.ApplyForce(aimDirection * bulletToClone.getShootingSpeed());
     newBullet.rotationV2 = aimDirection;
     triggerparticles("effect", startingLocation);
 }
Пример #3
0
 public weapon()
 {
     w_bullet = new bullet();
 }