//Add target
 public ProjectileBurst(Spell spell, GameHandler game, Entity target, Entity owner, Vector2 origin, float radSquared)
     : base(spell, game, target, owner)
 {
     this.origin = origin;
     this.radSquared = radSquared;
     lifetime = TIMEOUT;
     projPos = new List<Vector2>();
     projSpeed = new List<Vector2>();
 }
 public ProjectileBall(Spell spell, GameHandler game, Entity target, Entity owner, Vector2 pos, Vector2 direction, float speed)
     : base(spell, game, target, owner)
 {
     this.pos = pos;
     this.speed = speed;
     moveSpeed = direction * speed;
     lifetime = TIMEOUT;
     lastCollide = null;
 }
Beispiel #3
0
 public Projectile(Spell spell, GameHandler game, Entity target, Entity owner)
 {
     this.spell = spell;
     this.game = game;
     this.target = target;
     this.owner = owner;
     arcCount = spell.arcCount;
     size = new Vector2(4.0f, 4.0f); //To load
     projTexture = new AnimatedTexture(Main.content.Load<Texture2D>("flyingProj"), 3, 0.5f, 4, 4); //To load/implement
 }
Beispiel #4
0
 public override Projectile generateProjectiles(Vector2 pos, Spell spell, GameHandler game, Entity target, Entity owner)
 {
     ProjectileBurst projReturn = new ProjectileBurst(spell, game, target, owner, pos, spell.arcCount == 0 ? radSquared : arcRadSquared);
     Vector2 vecSpeed;
     for (int i = 0; i < partCount; i++)
     {
         vecSpeed = new Vector2((float)(random.NextDouble() < 0.5 ? random.NextDouble() : random.NextDouble() * -1.0), (float)(random.NextDouble() < 0.5 ? random.NextDouble() : random.NextDouble() * -1.0));
         vecSpeed.Normalize();
         vecSpeed *= (float)(random.NextDouble() * 2.0 + 1.0);
         projReturn.addProjectile(pos, vecSpeed);
     }
     return projReturn;
 }
Beispiel #5
0
 public override Projectile generateProjectiles(Vector2 pos, Spell spell, GameHandler game, Entity target, Entity owner)
 {
     Vector2 dir;
     if (target != null)
     {
         dir = target.pos - pos;
     }
     else
     {
         dir = game.posFromScreenPos(Main.newMouseState.Position.ToVector2()) - pos;//dir = game.player.dir.Vector();
     }
     dir.Normalize();
     return new ProjectileBall(spell, game, target, owner, pos, dir, speed);
 }
 public ProjectileStream(Spell spell, GameHandler game, Entity target, Entity owner)
     : base(spell, game, target, owner)
 {
     projectiles = new List<Vector2>();
     this.hasUpdated = false;
 }
Beispiel #7
0
 public bool onPlaceClick(float mouseX, float mouseY, ref Skill curHeld)
 {
     if (upArrowBounds.Contains(mouseX, mouseY))
     {
         if (player.selectedSpell > 0)
         {
             --player.selectedSpell;
         }
     }
     else if (downArrowBounds.Contains(mouseX, mouseY))
     {
         if (player.selectedSpell < 4)
         {
             ++player.selectedSpell;
         }
     }
     else if (!spell.Contains(curHeld))
     {
         if ((curHeld is SkillShape || curHeld == null) && shapeBounds.Contains(mouseX, mouseY))
         {
             spell = new Spell((SkillShape)curHeld, spell.modElement, spell.modTop, spell.modBottom);
         }
         else if (curHeld is SkillMod || curHeld == null)
         {
             if (modMidBounds.Contains(mouseX, mouseY))
             {
                 spell = new Spell(spell.shape, (SkillMod)curHeld, spell.modTop, spell.modBottom);
             }
             else if (modTopBounds.Contains(mouseX, mouseY))
             {
                 spell = new Spell(spell.shape, spell.modElement, (SkillMod)curHeld, spell.modBottom);
             }
             else if (modBottomBounds.Contains(mouseX, mouseY))
             {
                 spell = new Spell(spell.shape, spell.modElement, spell.modTop, (SkillMod)curHeld);
             }
             else
             {
                 return false;
             }
         }
         else
         {
             return false;
         }
         curHeld = null;
         return true;
     }
     return false;
 }
Beispiel #8
0
 //Deprecated
 public bool onClearClick(float mouseX, float mouseY)
 {
     if (shapeBounds.Contains(mouseX, mouseY))
     {
         spell = new Spell(null, spell.modElement, spell.modTop, spell.modBottom);
     }
     else if (modMidBounds.Contains(mouseX, mouseY))
     {
         spell = new Spell(spell.shape, null, spell.modTop, spell.modBottom);
     }
     else if (modTopBounds.Contains(mouseX, mouseY))
     {
         spell = new Spell(spell.shape, spell.modElement, null, spell.modBottom);
     }
     else if (modBottomBounds.Contains(mouseX, mouseY))
     {
         spell = new Spell(spell.shape, spell.modElement, spell.modTop, null);
     }
     else
     {
         return false; //Return false if nothing was changed
     }
     return true; //Return true if something was changed
 }
Beispiel #9
0
 public SpellContainer(Player player)
 {
     this.player = player;
     spell = new Spell(null, null, null, null);
     arrowTexture = Main.content.Load<Texture2D>("Arrows");
 }
Beispiel #10
0
 public abstract Projectile generateProjectiles(Vector2 pos, Spell spell, GameHandler game, Entity target, Entity owner);
Beispiel #11
0
        public override Projectile generateProjectiles(Vector2 origin, Spell spell, GameHandler game, Entity target, Entity owner)
        {
            Vector2 dir;
            if (target != null)
            {
                dir = target.pos - origin;
            }
            else
            {
                dir = game.posFromScreenPos(Main.newMouseState.Position.ToVector2()) - origin;//dir = game.player.dir.Vector();
            }
            dir.Normalize();

            ProjectileStream projReturn = new ProjectileStream(spell, game, target, owner);

            float maxMult = projReturn.ProcessCollision(origin, dir * length);

            float mult;
            for (int i = 0; i < partCount; i++)
            {
                mult = (float)random.NextDouble();
                if (mult < maxMult)
                {
                    projReturn.addProjectile(origin + dir * length * mult);
                }
            }

            return projReturn;
        }