/// <summary>
 /// 
 /// </summary>
 /// <param name="game"></param>
 /// <param name="initialPosition"></param>
 /// <param name="cannonBallManager"></param>
 /// <param name="width"></param>
 /// <param name="height"></param>
 /// <param name="rotation"></param>
 /// <param name="respawnTime">Time in seconds before a destroyed object will respawn.</param>
 public DamageablePhysicsGameObject(Game game, Vector2 initialPosition, CannonBallManager cannonBallManager,
     float width, float height, float rotation, int respawnTime)
     : this(game, initialPosition, cannonBallManager, width, height, rotation)
 {
     respawnTimer = new Timer(respawnTime);
     respawnOnDeath = true;
 }
Exemplo n.º 2
0
 public Tower(Game game, Vector2 position, List<IGameObject> targets, CannonBallManager cannonBallManager)
     : base(game, position, cannonBallManager, 40, 100, 0)
 {
     this.targets = targets;
     minTargetFocusTimer = new Timer(10f);
     range = 300;
     Cannon = new Cannon(game, this, cannonBallManager, new Vector2(0, -35), 0.0f);
     base.Body.IsStatic = true;
 }
Exemplo n.º 3
0
        public Cannon(Game game, PhysicsGameObject parentObject, CannonBallManager cannonBallManager, Vector2 positionalOffset, float rotationalOffset)
            : base(game)
        {
            this.game = game;
            this.attachedToObject = parentObject;
            this.cannonBallManager = cannonBallManager;
            this.positionalOffset = positionalOffset;
            this.rotationalOffset = rotationalOffset;

            firingTimer = new Timer(3f);
        }
        /// <summary>
        /// If you do not pass in a respawn time then this object will delete itself when it is destroyed.
        /// </summary>
        /// <param name="game"></param>
        /// <param name="initialPosition"></param>
        /// <param name="cannonBallManager"></param>
        /// <param name="width"></param>
        /// <param name="height"></param>
        /// <param name="rotation"></param>
        public DamageablePhysicsGameObject(Game game, Vector2 initialPosition, CannonBallManager cannonBallManager,
            float width, float height, float rotation)
            : base(game, initialPosition, width, height, rotation, ((CollisionGroupManager)game.Services.GetService(typeof(CollisionGroupManager))).getNextFreeCollisionGroup())
        {
            this.Health = 5;
            this.IsAlive = true;
            this.spawnPoint = initialPosition;

            this.OnCollision += ShipCollision;
            this.cannonBallManager = cannonBallManager;

            ObjectDestroyed += ObjectDestroyedEventHandler;
            ObjectRespawned += ObjectRespawnedEventHandler;
            ObjectDamaged += ObjectDamagedEventHandler;
        }
Exemplo n.º 5
0
        public Sloop(Game game, Vector2 initialPosition, CannonBallManager cannonBallManager, float initialRotation)
            : base(game, initialPosition, cannonBallManager, initialRotation)
        {
            //this.GoldCapacity = 3;
            //this.Gold = 0;

            var rotationMatrix = Matrix.Identity;

            var leftCannonPosition = new Vector2(rotationMatrix.Left.X, rotationMatrix.Left.Y) * ((this.Width / 2.0f)) + leftCannonOffset;
            var leftCannonRotation = MathHelper.ToRadians(-90);
            LeftCannons.Add(new Cannon(game, this, cannonBallManager, leftCannonPosition, leftCannonRotation));

            var rightCannonPosition = new Vector2(rotationMatrix.Right.X, rotationMatrix.Right.Y) * ((this.Width / 2.0f)) + rightCannonOffset;
            var rightCannonRotation = MathHelper.ToRadians(90);
            RightCannons.Add(new Cannon(game, this, cannonBallManager, rightCannonPosition, rightCannonRotation));
        }
Exemplo n.º 6
0
 public ShipFactory(Game game, SpriteBatch spriteBatch, CannonBallManager cannonBallManager)
     : base(game, spriteBatch)
 {
     this.CannonBallManager = cannonBallManager;
 }