public MagicPreviewerPanel(ContentManager Content, MagicSpell ActiveMagicSpell, ActionPanelHolder ListActionMenuChoice, ProjectileContext GlobalProjectileContext, SharedProjectileParams SharedParams, Vector2 UserPosition, Rectangle EnemyBounds) : base("Previewer", ListActionMenuChoice, true) { sprPixel = Content.Load <Texture2D>("pixel"); ListProjectile = new List <Projectile>(); Vector2[] SandboxPoints = new Vector2[4] { new Vector2(0, 0), new Vector2(0, Constants.Height), new Vector2(Constants.Width, Constants.Height), new Vector2(Constants.Width, 0), }; SandboxCollisionBox = new Polygon(SandboxPoints, Constants.Width, Constants.Height); Vector2[] EnemyPoints = new Vector2[4] { new Vector2(EnemyBounds.X, EnemyBounds.Y), new Vector2(EnemyBounds.X, EnemyBounds.Bottom), new Vector2(EnemyBounds.Right, EnemyBounds.Bottom), new Vector2(EnemyBounds.Right, EnemyBounds.Y), }; EnemyCollisionBox = new Polygon(EnemyPoints, Constants.Width, Constants.Height); MagicUser ActiveUser = new MagicUser(); ActiveUser.ManaReserves = 1000; ActiveUser.CurrentMana = 100; SharedParams.OwnerPosition = UserPosition; GlobalProjectileContext.OwnerSandbox = this; MagicSpell NewSpell = new MagicSpell(ActiveMagicSpell, ActiveUser); ListMagicSpell = NewSpell.ComputeSpell(); }
public override void Update(GameTime gameTime) { CursorPosition = new Vector2(MouseHelper.MouseStateCurrent.X, MouseHelper.MouseStateCurrent.Y); Point Center = new Point(-CameraOffset.X - Constants.Width / 2, -CameraOffset.Y - Constants.Height / 2); Transform = Matrix.CreateTranslation(-Center.X, -Center.Y, 0) * Matrix.CreateScale(ZoomLevel) * Matrix.CreateTranslation(CameraOffset.X, CameraOffset.Y, 0); if (ListActionMenuChoice.HasMainPanel) { ListActionMenuChoice.Last().Update(gameTime); } DoUpdateEditor(gameTime); if (KeyboardHelper.KeyPressed(Microsoft.Xna.Framework.Input.Keys.Escape)) { FinishEditing(); ActiveMagicSpell.ComputeSpell(); RemoveScreen(this); } }