private SpellMissile CalculateSimpleShot(Shape shooter, Vector2 target) { float spellAngleNR = (float)(spellAngle / Math.PI * 180); float angle = 3.6f * 4; int divider = 15; SpellMissile tempMissile = new SpellMissile(spell, spell.spellTextureSpriteSheet, 1, shooter.position, true, default(Vector2), spell.spellName, spell.spellHitBox); float maxAngle = 0f; float minAngle = 0f; float deltaY = target.Y - tempMissile.centerPoint.Y; float deltaX = target.X - tempMissile.centerPoint.X; float angleVector = (float)(Math.Atan2(deltaY, deltaX) + Math.PI / 2); maxAngle = angleVector + (float)(Math.PI / 3); maxAngle = angleVector - (float)(Math.PI / 3); spellAngleNR = (float)(angleVector * 180 / Math.PI); if (spellAngleNR < 0) { spellAngleNR += 360; } if (spellAngleNR > 360 - 45 && spellAngleNR < 45) { tempMissile.Rotate(0); } else if (spellAngleNR < 360 - 45 && spellAngleNR > 360 - 45 - 90) { tempMissile.Rotate(90); } else if (spellAngleNR < 360 - 45 - 90 && spellAngleNR > 45 + 90) { tempMissile.Rotate(180); } else if (spellAngleNR > 45 && spellAngleNR < 45 + 90) { tempMissile.Rotate(270); } //Console.Out.WriteLine(angleVector*180/Math.PI); tempMissile.speed = 3; tempMissile.bStopAtTarget = false; // shapes[shapes.Count - 1].SetVelocity(new Vector2((float)Math.Sin(spellAngle), (float)Math.Cos(spellAngle)) * speed); tempMissile.SetVelocity(angleVector); return(tempMissile); }
private void AdjustModifiers(SpellMissile missile) { if (missile.baseSpell.CauseEffect()) { statusEffect = missile.baseSpell.spellStatusEffect; temp = missile.baseSpell.effectChance; } else if (missile.baseSpell.CauseModifier()) { statusModifier = missile.baseSpell.spellStatusModifier; temp2 = missile.baseSpell.modifierChance; } }
public virtual bool Contains(SpellMissile missile) { if (proximityIndicator.Intersects(missile.proximityIndicator) && bCollision) { if (!bHasDynamicHitbox) { foreach (var hitbox in shapeHitBox) { foreach (var target in missile.shapeHitBox) { if (hitbox.Intersects(target)) { return(true); } } } } } return(false); }
public override bool Contains(SpellMissile missile) { if (proximityIndicator.Intersects(missile.proximityIndicator)) { foreach (var hitbox in shapeHitBox) { foreach (var target in missile.shapeHitBox) { if (hitbox.Intersects(target)) { hitString = "You've been hit by,\nyou've been hit by,\na smooth " + missile.shapeName; AdjustModifiers(missile); return(true); } } } } return(false); }