Esempio n. 1
0
        public override void Swing(Damageable target)
        {
            if (fireCooldown < 0)
            {
                hitting = true;

                if (target is Unit)
                {
                    AggroEvent e = new AggroEvent(this, target, true);
                    ((Unit)target).OnAggroRecieved(e);
                    this.OnAggro(e);
                }

                SoundManager.GetInstance().PlaySFX(SoundManager.GetInstance().lanceSounds);

                DamageEvent dmgEvent = new DamageEvent(new MeleeSwing(PathfindingTest.Combat.DamageEvent.DamageType.Melee, baseDamage), target, this);
                target.OnDamage(dmgEvent);
                this.fireCooldown = this.rateOfFire;

                // We already know that this unit is local
                if (Game1.GetInstance().IsMultiplayerGame())
                {
                    Synchronizer.GetInstance().QueueDamageEvent(dmgEvent);
                }
            }
        }
Esempio n. 2
0
 /// <summary>
 /// Attempt to fire the weapon!
 /// </summary>
 public override void Swing()
 {
     if (this.fireCooldown < 0)
     {
         AggroEvent e = new AggroEvent(this, unitToStalk, true);
         unitToStalk.OnAggroRecieved(e);
         this.OnAggro(e);
         this.projectiles.AddLast(new Arrow(this, unitToStalk));
         this.fireCooldown = this.rateOfFire;
     }
 }
Esempio n. 3
0
 public override void OnAggroRecieved(AggroEvent e)
 {
     if (unitToStalk == null)
     {
         unitToStalk = e.from;
     }
     if (friendliesProtectingMe.Count() > 0)
     {
         for( int i = 0; i < this.friendliesProtectingMe.Count(); i++){
             this.friendliesProtectingMe.ElementAt(i).OnAggroRecieved(e);
         }
     }
     //Console.Out.WriteLine("Recieved aggro from something! D=");
 }
Esempio n. 4
0
 /// <summary>
 /// Attempt to fire the weapon!
 /// </summary>
 public override void Fire()
 {
     if (this.fireCooldown < 0)
     {
         CheckForEnemiesInRange();
         if (this.enemiesInRange.Count == 0) { return; }
         Unit targetUnit = this.enemiesInRange.ElementAt(0);
         AggroEvent e = new AggroEvent(this, targetUnit, true);
         targetUnit.OnAggroRecieved(e);
         this.OnAggro(e);
         this.projectiles.AddLast(new Arrow(this, targetUnit));
         this.fireCooldown = this.rateOfFire;
     }
 }
Esempio n. 5
0
        /// <summary>
        /// Attempt to swing the weapon!
        /// </summary>
        public override void Swing()
        {
            AggroEvent e = new AggroEvent(this, unitToStalk, true);
            unitToStalk.OnAggroRecieved(e);
            this.OnAggro(e);
            DamageEvent dmgEvent = new DamageEvent(new MeleeSwing(PathfindingTest.Combat.DamageEvent.DamageType.Melee, baseDamage), unitToStalk, this);
            unitToStalk.OnDamage(dmgEvent);
            this.fireCooldown = this.rateOfFire;

            // We already know that this unit is local
            if (Game1.GetInstance().IsMultiplayerGame())
            {
                Synchronizer.GetInstance().QueueDamageEvent(dmgEvent);
            }
        }
Esempio n. 6
0
 public override void OnAggroRecieved(AggroEvent e)
 {
     if (unitToStalk == null)
     {
         unitToStalk = e.from;
     }
     if (friendliesProtectingMe.Count > 0)
     {
         foreach (Unit unit in friendliesProtectingMe)
         {
             unit.OnAggroRecieved(e);
         }
     }
     //Console.Out.WriteLine("Recieved aggro from something! D=");
 }
Esempio n. 7
0
 public override void OnAggro(AggroEvent e)
 {
     // Console.Out.WriteLine("Aggroing something, *grins*");
 }
Esempio n. 8
0
 public abstract void OnAggroRecieved(AggroEvent e);
Esempio n. 9
0
 public abstract void OnAggro(AggroEvent e);
Esempio n. 10
0
 public override void OnAggroRecieved(AggroEvent e)
 {
     //todo flee
     // Console.Out.WriteLine("Recieved aggro from something! D=");
 }
Esempio n. 11
0
 /// <summary>
 /// Attempt to fire the weapon!
 /// </summary>
 public override void Swing(Damageable target)
 {
     if (this.fireCooldown < 0)
     {
         if (target is Unit)
         {
             AggroEvent e = new AggroEvent(this, target, true);
             ((Unit)target).OnAggroRecieved(e);
             this.OnAggro(e);
         }
         this.projectiles.AddLast(new Arrow(this, target));
         this.fireCooldown = this.rateOfFire;
     }
 }