This is the superclass of all enemies in the game.
Inheritance: GameObject
コード例 #1
0
        /// <summary>
        /// This implementation of fire creates an AOEProjectile and
        /// destroys the tower.
        /// </summary>
        /// <param name="target">The creep that set off the laser.</param>
        public override void Fire(Creep target)
        {
            base.Fire(target);

            LaserProjectile p = new LaserProjectile(Game, Position, Vector2.Zero, target.Position - Position, AttackPower);

            p.ObjectSprite = new AnimatedSpriteInstance(GraphicsPool.Laser, DEFAULT_LOOP);

            GameState.Singleton.CurrentLevel.Projectiles.AddLast(p);
        }
コード例 #2
0
        /// <summary>
        /// This implementation of fire creates an AOEProjectile and
        /// destroys the tower.
        /// </summary>
        /// <param name="target">The creep that caused the explosion.</param>
        public override void Fire(Creep target)
        {
            base.Fire(target);

            AOEProjectile p = new AOEProjectile(Game, Position, Vector2.Zero, AttackPower);

            p.ObjectSprite = new AnimatedSpriteInstance(GraphicsPool.Ex, DEFAULT_LOOP);

            GameState.Singleton.CurrentLevel.Projectiles.AddLast(p);
            p.Radius = this.Range;

            Alive = false;
        }
コード例 #3
0
        public static Creep TransportTruck(int waveNum)
        {
            Creep ret = new Creep(Game);

            ret.Wavenum = waveNum;
            ret.ObjectSprite = new AnimatedSpriteInstance(GraphicsPool.Car4, GameObject.DEFAULT_LOOP);
            ret.Speed = 1.5f;
            ret.hp = 20;
            ret.moneyValue = 0.3;
            ret.pointValue = 1;

            //TODO: Calculate stats!!

            return ret;
        }
コード例 #4
0
        /// <summary>
        /// The implementation of this fire method creates a basic projectile that
        /// is heading towards the target with a high velocity.
        /// </summary>
        /// <param name="target"></param>
        public override void Fire(Creep target)
        {
            if (target == null) return;

            base.Fire(target);

            Vector2 vel = target.Position - this.Position;
            vel.Normalize();

            vel *= SlowProjectile.DEFAULT_SPEED;

            SlowProjectile p = new SlowProjectile(Game, this.Position, vel, this.AttackPower);

            p.ObjectSprite = new AnimatedSpriteInstance(GraphicsPool.Bullet3, DEFAULT_LOOP);

            // Add the projectile to a the current level's projectile list.
            GameState.Singleton.CurrentLevel.Projectiles.AddLast(p);
        }
コード例 #5
0
        /// <summary>
        /// The implementation of this fire method creates a basic projectile that
        /// is heading towards the target with a high velocity.
        /// </summary>
        /// <param name="target">The creep that is being shot.</param>
        public override void Fire(Creep target)
        {
            if (target == null) return;

            base.Fire(target);

            Vector2 vel = target.Position - this.Position;
            vel.Normalize();
            vel *= Projectile.DEFAULT_SPEED;

            BasicProjectile p = new BasicProjectile(Game, this.Position, vel, this.AttackPower)
            {
                //TODO: Replace this with an appropriate sprite field or something.
                ObjectSprite = new AnimatedSpriteInstance(GraphicsPool.Bullet1, DEFAULT_LOOP)
            };

            // Add the projectile to the current leve's collection
            GameState.Singleton.CurrentLevel.Projectiles.AddLast(p);
        }
コード例 #6
0
 public static int defaultStats(Creep c)
 {
     return c.Wavenum;
 }
コード例 #7
0
 public static float defaultSpeed(Creep c)
 {
     return 1f;
 }
コード例 #8
0
ファイル: Tower.cs プロジェクト: dideler/gps-tower-defense
 /// <summary>
 /// Executes a "firing" function at the target creep.
 /// </summary>
 public virtual void Fire(Creep target)
 {
 }
コード例 #9
0
 /// <summary>
 /// The overrided collision effect causes a slow counter
 /// to be added rather than damage to be caused.
 /// </summary>
 /// <param name="c">The creep on which the effect will be applied.</param>
 protected override void CollisionEffect(Creep c)
 {
     c.slowCounters++;
         Alive = false;
 }
コード例 #10
0
 /// <summary>
 /// What happens when this projectile collides with a creep.
 /// </summary>
 /// <param name="c">The creep on which to apply the collision effect.</param>
 protected virtual void CollisionEffect(Creep c)
 {
     c.ReceiveDamage(AttackPower);
     Alive = false;
 }