public override void Execute(object source, DamageEventInfo info) { DamageInfo damage = info.Info; int projCount = Mathf.RoundToInt(BaseProjectileCount.Get() * Coeffecient.Get()); float step = (StartAngle.Get() - EndAngle.Get()) / (projCount - (IncludeLast ? 1 : 0)); for (int i = 0; i < projCount; i++) { float angle = StartAngle.Get() - step * i + (HalfOffset ? step / 2f : 0f); Vector3 dir = Quaternion.Euler(0f, 0f, angle) * damage.Projectile.Direction; GameObject newProjectile = Object.Instantiate(damage.Projectile.gameObject, damage.Point, Quaternion.identity); Projectile projectile = newProjectile.GetComponent <Projectile>(); AttachProjectileToSources(projectile); projectile.SetProcLayer(damage.Projectile.ProcLayer + 1); projectile.Fire(damage.Projectile.Weapon, dir, damage.Projectile.Layer, damage.Projectile.Target, damage.Amount * DamageCoeffecient.Get(), damage.Projectile.Range * RangeCoeffecient.Get()); } }
public override void ApplyEffect(IModdable target) { _target = target; IStatContainer container = target as IStatContainer; Stat stat = container.GetStat(Identifier); //TODO: Consider having StatType be a member of Stat instead of StatMod, then handling how to add the stat in Stat. switch (Type) { case StatType.Additive: stat.AddAdditive(Value.Get() * Coeffecient.Get(), this); break; case StatType.Multiplicative: stat.AddMultiplicative(Value.Get() * Coeffecient.Get(), this); break; } }
public override void Execute(object source, DamageEventInfo info) { DamageInfo damage = info.Info; GameObject newExplosion = Object.Instantiate(ProjectilePrefab.Get() as GameObject, info.Info.Point, Quaternion.identity); Projectile proj = newExplosion.GetComponent <Projectile>(); proj.Fire(damage.Projectile.Weapon, damage.Projectile.Direction, damage.Projectile.Layer, damage.Projectile.Target, damage.Amount * DamageCoeffecient.Get(), Mathf.Sqrt(damage.Amount * AreaCoeffecient.Get() / Mathf.PI) * Coeffecient.Get()); AttachProjectileToSources(proj); if (IncrementProcLayer) { proj.SetProcLayer(damage.Projectile.ProcLayer + 1); } }
public override void Execute(object source, DamageEventInfo info) { DamageInfo damage = info.Info; Vector2 newDirection = Vector2.Reflect(damage.Projectile.Direction, damage.Normal); GameObject newProjectile = Object.Instantiate(damage.Projectile.gameObject, damage.Point, Quaternion.LookRotation(newDirection, Vector3.back)); Projectile proj = newProjectile.GetComponent <Projectile>(); AttachProjectileToSources(proj); proj.Fire(damage.Projectile.Weapon, newDirection, damage.Projectile.Layer, damage.Projectile.Target, damage.Amount * DamageCoeffecient.Get() * Coeffecient.Get(), damage.Projectile.Range * RangeCoeffecient.Get()); }