protected bool[] drawFlagArray; //indicates whether to draw each individual sprite; /// <summary> /// /// </summary> /// <param name="ProjectilePath">Points to move through in the grid</param> /// <param name="EffectList">Effects to take on each target hit.</param> /// <param name="ProjectileAnimations">The animations that will play as this projectile flies.</param> /// <param name="ImpactSprite">Sprite while plays once when the projectile hits a target.</param> /// <param name="Caster">Originator of the projectile.</param> /// <param name="targetEnemies">Chooses whether this projectile will hit enemies</param> /// <param name="targetFriendlies">Chooses whether this projectile will hit people on the same team</param> /// <param name="DamageFalloff">Ratio by which to reduce each effect each time a target is hit. (multiplies by 1-damageFalloff)</param> /// <param name="DurationFalloff">Ratio by which to reduce each effect duration each time a target is hit. (multiplies by 1-durationFalloff</param> public SpaceProjectile(List<Vector2> ProjectilePath, AbilityEffect[] EffectList, Sprite[] ProjectileAnimations, Sprite ImpactSprite, Person Caster = null, bool targetEnemies = true, bool targetFriendlies = false, float DamageFalloff = 0, float DurationFalloff = 0) : base(EffectList, ProjectileAnimations, ImpactSprite, Caster, targetEnemies, targetFriendlies, DamageFalloff, DurationFalloff) { Path = ProjectilePath; }
protected bool deleteFlag = false; //Indicates to the owning space whether this projectile is ready to be deleted. #endregion #region Setup /// <summary> /// Constructs a projectile to carry Ability Effects across the screen. /// </summary> /// <param name="EffectList">Effects to take on each target hit.</param> /// <param name="ProjectileAnimations">The animations that will play as this projectile flies.</param> /// <param name="ImpactSprite">Sprite while plays once when the projectile hits a target.</param> /// <param name="Caster">Originator of the projectile.</param> /// <param name="DamageFalloff">Ratio by which to reduce each effect each time a target is hit. (multiplies by 1-damageFalloff)</param> /// <param name="DurationFalloff">Ratio by which to reduce each effect duration each time a target is hit. (multiplies by 1-durationFalloff)</param> /// <param name="targetEnemies">Chooses whether this projectile will hit enemies.</param> /// <param name="targetFriendlies">Chooses whether this projectile will hit people on the same team</param> public Projectile(AbilityEffect[] EffectList, Sprite[] ProjectileAnimations, Sprite ImpactSprite, Person Caster = null, bool targetEnemies = true, bool targetFriendlies = false, float DamageFalloff = 0, float DurationFalloff = 0) { effects = EffectList; projectileAnimations = ProjectileAnimations; impactSprite = ImpactSprite; caster = Caster; damageFalloff = DamageFalloff; durationFalloff = DurationFalloff; targetsHit = new List<Person>(); hitEnemies = targetEnemies; hitFriendlies = targetFriendlies; }
protected float distanceToTravel, distanceTravelled; //Trackers for the delete flag, so that we can delete once it's hit its target. #endregion #region Setup /// <summary> /// Creates a projectile which moves in a straight line from caster to target /// </summary> /// <param name="target">Person at which the projectile is aimed.</param> /// <param name="Speed">Speed at which the projectile moves per frame</param> /// <param name="EffectList">All the effects to put on targets</param> /// <param name="ProjectileAnimations">The animations that will play as this projectile flies.</param> /// <param name="ImpactSprite">Sprite while plays once when the projectile hits a target.</param> /// <param name="Caster">Originator of the projectile.</param> /// <param name="DamageFalloff">Ratio by which to reduce each effect each time a target is hit. (multiplies by 1-damageFalloff)</param> /// <param name="DurationFalloff">Ratio by which to reduce each effect duration each time a target is hit. (multiplies by 1-durationFalloff</param> /// <param name="targetEnemies">Chooses whether this projectile will hit enemies</param> /// <param name="targetFriendlies">Chooses whether this projectile will hit people on the same team</param> /// <param name="CasterToProjectileAnim">Sprite that displays between the caster and the projectile.</param> /// <param name="CasterToTargetAnim">Sprite that displays between the caster and the target</param> /// <param name="ProjectileToTargetAnim">Sprite that displays between the projectile and the target</param> public StraightProjectile(Person target, float Speed, AbilityEffect[] EffectList, Sprite[] ProjectileAnimations, Sprite ImpactSprite = null, Person Caster = null, bool targetEnemies = true, bool targetFriendlies = false, float DamageFalloff = 0, float DurationFalloff = 0, Sprite CasterToProjectileAnim = null, Sprite CasterToTargetAnim = null, Sprite ProjectileToTargetAnim = null) : base(EffectList, ProjectileAnimations, ImpactSprite, Caster, targetEnemies, targetFriendlies, DamageFalloff, DurationFalloff) { originLoc = Caster.ScreenPositionNoOffset; currentLoc = Caster.ScreenPositionNoOffset; targetLoc = target.ScreenPositionNoOffset; animCasterToProj = CasterToProjectileAnim; animCasterToTarget = CasterToTargetAnim; animProjToTarget = ProjectileToTargetAnim; speed = Speed; distanceTravelled = 0; distanceToTravel = Vector2.Distance(originLoc, targetLoc); }
/// <summary> /// Causes the effect to this person, and if it has any durations, adds the effect to the person's list. /// </summary> /// <param name="effectToTake">Effect to deal to this person.</param> public void takeEffect(AbilityEffect effectToTake) { takeDamage(effectToTake.Caster, effectToTake.DamageOnHit, effectToTake.EnergyDamage); if (effectToTake.DoTDuration + effectToTake.EoTDuration > 0) { effects.Add(effectToTake); } }