public void addAmmo(Ammunition ammo)
 {
     otherObjects.Add(ammo);
 }
예제 #2
0
        private void onRelease()
        {
            if (isBeingDragged)
            {
                isBeingDragged = false;

                Vector2 fireTrajectory = (draggedToPoint - new Vector2(draggablePosition.Center.X, draggablePosition.Center.Y)) * powerScale;
                Console.WriteLine("Fire trajectory: " + fireTrajectory.ToString());
                if (Math.Pow(fireTrajectory.X, 2) + Math.Pow(fireTrajectory.Y, 2) >= Math.Pow(minPower, 2))
                {
                    Ammunition newAmmo = new Ammunition(this, fireTrajectory, new Vector2(draggablePosition.Center.X, draggablePosition.Center.Y), ammoTexture, damage);
                    ammo.Add(newAmmo);
                    collisionManager.addAmmo(newAmmo);
                }
            }
        }
 public void removeAmmo(Ammunition ammoToRemove)
 {
     otherObjects.Remove(ammoToRemove);
 }