コード例 #1
0
ファイル: td_Tower.cs プロジェクト: milesgray/resatiate
        /// <summary>
        /// Initializes a new Enemy.
        /// </summary>
        /// <param name="gamePage">The GamePage that has the SpriteBatch the cat should use for rendering.</param>
        public td_Tower(string id, Game game, SpriteBatch spriteBatch, td_Level level, int x, int y)
            : base(game)
        {
            this.ID = id;

            this.spriteBatch = spriteBatch;

            this.level = level;

            this.TextureName = "Tower";

            //this.Bullets = new List<td_Bullet>();

            this.FireCooldown = 0;
            this.FireCooldownRate = 1;
            this.FireRate = 40;
            this.BulletRange = 700;
            this.BulletDamage = 10;
            this.BulletArmorPierce = 6;
            this.BulletDamageType = DamageType.Bullet;
            this.BulletSize = 10;

            // Generate a rotation offset
            //rotationOffset = (float)random.NextDouble() * MathHelper.Pi;

            // Generate a random position
            Position = new Vector2(x, y); // bottomish middle??

            // Generate a random velocity
            //int xDirection = random.Next() % 2 == 0 ? 1 : -1;
            //int yDirection = random.Next() % 2 == 0 ? 1 : -1;
            Angle = new Vector2(0, 0); // none?
            //     random.Next(100, 200) * xDirection,
            //    random.Next(100, 200) * yDirection);
        }
コード例 #2
0
ファイル: td_Enemy.cs プロジェクト: milesgray/resatiate
        /// <summary>
        /// Initializes a new Enemy.
        /// </summary>
        /// <param name="gamePage">The GamePage that has the SpriteBatch the cat should use for rendering.</param>
        public td_Enemy(Game game, SpriteBatch spriteBatch, float scale, td_Level level, int armor, int hp)
            : base(game)
        {
            this.level = level;
            this.spriteBatch = spriteBatch;

            this.TextureName = "Enemy";

            this.IsDead = false;
            this.HP = hp;
            this.Armor = armor;
            this.scale = scale;

            // Generate a rotation offset
            //rotationOffset = (float)random.NextDouble() * MathHelper.Pi;

            // Generate a random position
            Position = new Vector2(0, 80); // top left?

            // Generate a random velocity
            //int xDirection = random.Next() % 2 == 0 ? 1 : -1;
            //int yDirection = random.Next() % 2 == 0 ? 1 : -1;
            Velocity = new Vector2(10, 0); // right?
            //     random.Next(100, 200) * xDirection,
            //    random.Next(100, 200) * yDirection);
        }
コード例 #3
0
ファイル: td_EnemyWave.cs プロジェクト: milesgray/resatiate
        public td_EnemyWave(Game game, SpriteBatch spriteBatch, td_Level level)
            : base(game)
        {
            this.spriteBatch = spriteBatch;
            this.level = level;

            Delay = 3;
            DelayCount = 0;

            TotalEnemiesSpawned = 0;

            EnemiesAlive = new List<td_Enemy>();
        }
コード例 #4
0
ファイル: td_Bullet.cs プロジェクト: milesgray/resatiate
        /// <summary>
        /// Initializes a new Bullet.
        /// </summary>
        /// <param name="gamePage">The GamePage that has the SpriteBatch the cat should use for rendering.</param>
        public td_Bullet(Game game, SpriteBatch spriteBatch, td_Level level, 
            Vector2 velocity, Vector2 position, int range,
            int damage, DamageType damageType, int armorPierce, int size)
            : base(game)
        {
            this.IsGarbage = false;

            this.spriteBatch = spriteBatch;

            this.TextureName = "Bullet";

            this.Position = position;
            this.Velocity = velocity;

            this.Origin = new Vector2(position.X, position.Y);
            this.Range = range;

            this.Damage = damage;
            this.DamageType = damageType;
            this.ArmorPierce = armorPierce;
            this.Size = size;

            this.level = level;
        }