private Attack GetAnimationStartSandbox(MagicSpell ActiveSpell, Vector2 AnimationOrigin, out List <Projectile> ListOutputProjectile) { MagicProjectileSandboxStartAnimation AnimationStartSandbox = new MagicProjectileSandboxStartAnimation(); GlobalContext.OwnerSandbox = AnimationStartSandbox; SharedParams.OwnerPosition = AnimationOrigin; SharedParams.OwnerAngle = 0; List <BaseAutomaticSkill> ListAttackAttribute = ActiveSpell.ComputeSpell(); Attack SpellAttack = new Attack("Dummy Attack"); SpellAttack.ArrayAttackAttributes = ListAttackAttribute.ToArray(); ListOutputProjectile = AnimationStartSandbox.SimulateAttack(SpellAttack); foreach (Projectile ActiveProjectile in ListOutputProjectile) { float MinX = float.MaxValue; float MinY = float.MaxValue; float MaxX = float.MinValue; float MaxY = float.MinValue; for (int P = ActiveProjectile.Collision.ListCollisionPolygon.Count - 1; P >= 0; --P) { for (int V = ActiveProjectile.Collision.ListCollisionPolygon[P].ArrayVertex.Length - 1; V >= 0; --V) { if (ActiveProjectile.Collision.ListCollisionPolygon[P].ArrayVertex[V].X < MinX) { MinX = ActiveProjectile.Collision.ListCollisionPolygon[P].ArrayVertex[V].X; } if (ActiveProjectile.Collision.ListCollisionPolygon[P].ArrayVertex[V].X > MaxX) { MaxX = ActiveProjectile.Collision.ListCollisionPolygon[P].ArrayVertex[V].X; } if (ActiveProjectile.Collision.ListCollisionPolygon[P].ArrayVertex[V].Y < MinY) { MinY = ActiveProjectile.Collision.ListCollisionPolygon[P].ArrayVertex[V].Y; } if (ActiveProjectile.Collision.ListCollisionPolygon[P].ArrayVertex[V].Y > MaxY) { MaxY = ActiveProjectile.Collision.ListCollisionPolygon[P].ArrayVertex[V].Y; } } } //Offset almost completely outside screen ActiveProjectile.Offset(new Vector2(Constants.Width + MaxX - 1, 0)); ActiveProjectile.IsAlive = true; } return(SpellAttack); }
protected MagicProjectileSandboxStartAnimation GetAnimationStartSandbox(Vector2 AnimationOrigin) { MagicProjectileSandboxStartAnimation AnimationStartSandbox = new MagicProjectileSandboxStartAnimation(); GlobalContext.OwnerSandbox = AnimationStartSandbox; SharedParams.OwnerPosition = AnimationOrigin; SharedParams.OwnerAngle = 0; List <BaseAutomaticSkill> ListAttackAttribute = new MagicSpell(Owner, Owner.GlobalContext.ActiveTarget).ComputeSpell(); Attack SpellAttack = new Attack(); SpellAttack.ArrayAttackAttributes = ListAttackAttribute.ToArray(); AnimationStartSandbox.SimulateAttack(SpellAttack); return(AnimationStartSandbox); }