예제 #1
0
        /// <summary>
        /// Default constructor
        /// </summary>
        /// <param name="damageStrengh">Damage done by normal strengh</param>
        /// <param name="damageMagic">Damage done by magic power</param>
        /// <param name="damageRange">Ranged damages, 0 for nothing</param>
        /// <param name="launcher">Tower which launched the bullet</param>
        /// <param name="target">Target of bullet</param>
        /// <param name="image">Image of bullet</param>
        public Bullet(int damageStrengh, int damageMagic, int damageRange, Tower launcher, Monster target, String image)
        {
            // Assign attack data
            this.damageStrengh = damageStrengh;
            this.damageMagic = damageMagic;
            this.damageRange = damageRange;
            this.x = launcher.Location.X;
            this.y = launcher.Location.Y;
            this.target = target;
            this.launcher = launcher;

            // Prepare visual control
            image = Map.TowerLocation.BaseFolder + image;

            // Add visual control to UI
            Application.Current.Dispatcher.BeginInvoke((Action)delegate()
            {
                this.control = new View.Control.BulletControl(image);
                this.control.move(this.x, this.y);
                this.control.changeZIndex(10000);
            });
        }
예제 #2
0
 /// <summary>
 /// Cancel bullets targeting a specific monster, because he walked through a portal
 /// </summary>
 /// <param name="monster">Monster targeted by bullets</param>
 public void cancelBulletsTargeting(Monster monster)
 {
     foreach (Bullet bullet in this.bullets)
     {
         if (bullet.Target == monster)
         {
             this.bulletsToDelete.Add(bullet);
             bullet.dispose();
         }
     }
 }
예제 #3
0
 /// <summary>
 /// Triggered when a monster arrives in the trap
 /// </summary>
 /// <param name="monster">Monster who arrived</param>
 public abstract void monsterArrived(Monster monster);