Esempio n. 1
0
        protected List<IWeapon> weapons; //the weapons installed on the ship

        #endregion Fields

        #region Constructors

        /// <summary>
        /// Instance a spaceship.
        /// When inheriting from this class, it is important to set the animationFrame.
        /// To animate, make the method "public override void Update(GameTime gameTime){//Your animation code here}"
        /// </summary>
        /// <param name="mass">The mass of the ship in kilograms</param>
        /// <param name="health">The maximum health of the ship, current starts at maximum</param>
        /// <param name="armor">The armor of the ship, starts at 100% effectiveness</param>
        /// <param name="blastRadius">The blast radius of the shp, the higher number, the bigger explosion at death</param>
        /// <param name="blastDamage">The damage of the explosion</param>
        /// <param name="registration">The connection of ownership between a ship and a player</param>
        /// <param name="position">The starting position of the ship</param>
        /// <param name="rotation">The starting rotation of the ship, in radians</param>
        /// <param name="graphic">The sprite or spritesheet that represents the ship</param>
        public SpaceShip(double mass, double health, double armor, double blastRadius, double blastDamage, Ownership registration, Vector2 position, double rotation, Texture2D graphic)
            : base(position, rotation, Vector2.Zero, Vector2.Zero, mass, 0, health, health, armor, 100, blastRadius, blastDamage, graphic)
        {
            currentThrust = 0;

            this.registration = registration;
            weapons = new List<IWeapon>();
            weapons.Add(ConcreteWeaponFactory.CreateWeapon("gun"));

            currentWeapon = weapons[0];

            abilities = new List<IAbility>();
            abilities.Add(ConcreteAbilityFactory.CreateAbility("shield"));
            currentAbility = abilities[0];

            shopString = new Dictionary<String, String>();
            shopWindow = "main";
            CreateShop();
        }
Esempio n. 2
0
 public ISpaceShip BuildSpaceship(Ownership ownership, Vector2 position, double rotation)
 {
     return new ConcreteShip_Eightwing(ownership, position, rotation);
 }
Esempio n. 3
0
 /// <summary>
 /// Create a ship
 /// </summary>
 /// <param name="ability">The ship type</param>
 /// <param name="ownership">The craft registration; link to owner</param>
 /// <param name="position">Where to build the ship</param>
 /// <param name="rotation">The ship orientation</param>
 /// <returns>The created ship</returns>
 public static ISpaceShip BuildSpaceship(String ship, Ownership ownership, Vector2 position, double rotation)
 {
     return Instance().factories[ship].BuildSpaceship(ownership, position, rotation);
 }
Esempio n. 4
0
        // Sets up ship
        private ISpaceShip setUpShip(IPlayer controller, String shipType, Vector2 position)
        {
            Ownership registration = new Ownership();
            registration.SetOwner(controller);
            controller.SetOwnerShip(registration);

            ISpaceShip ship = ConcreteShipFactory.BuildSpaceship(shipType, registration, position, 0);

            registration.SetShip(ship);
            return ship;
        }
Esempio n. 5
0
File: Ai.cs Progetto: bjorfoss/XNAX1
 public void SetOwnerShip(Ownership ownerLink)
 {
     this.ownerLink = ownerLink;
 }
Esempio n. 6
0
 /// <summary>
 /// Instance a basic fighter. Supply the initial position and facing
 /// </summary>
 /// 
 public ConcreteShip_Fighter(Ownership registration, Vector2 position, double rotation)
     : base(20000, 10000, 700, 64, 100, registration, position, rotation, GraphicBank.getInstance().GetGraphic("fighter"))
 {
     animationFrame = new Rectangle(0, 0, 128, 128);
 }
Esempio n. 7
0
 /// <summary>
 /// Instance a basic fighter. Supply the initial position and facing
 /// </summary>
 /// 
 public ConcreteShip_Eightwing(Ownership registration, Vector2 position, double rotation)
     : base(20000, 10000, 500, 30, 40, registration, position, rotation, GraphicBank.getInstance().GetGraphic("eightwing"))
 {
     animationFrame = new Rectangle(0, 0, 128, 128);
     unitColor = Color.DimGray;
 }