From: Ben Beltran Date: Tue, 19 Nov 2013 03:51:56 +0000 (-0600) Subject: I have the worst commits ever. X-Git-Url: https://git.r.bdr.sh/rbdr/super-polarity/commitdiff_plain/74c155708d85abfc2cf227c08de4f27003015b3f?ds=inline;hp=38c7d3f9eb7d63937c6654ff5dd6046ce02dd59c I have the worst commits ever. --- diff --git a/Super Polarity Content/Super Polarity ContentContent/Fonts/SegoeUIMono14.spritefont b/Super Polarity Content/Super Polarity ContentContent/Fonts/SegoeUIMono14.spritefont new file mode 100644 index 0000000..6c68f5d --- /dev/null +++ b/Super Polarity Content/Super Polarity ContentContent/Fonts/SegoeUIMono14.spritefont @@ -0,0 +1,60 @@ + + + + + + + Segoe UI Mono + + + 14 + + + 0 + + + true + + + + + + + + + + + + ~ + + + + diff --git a/Super Polarity/ActorFactory.cs b/Super Polarity/ActorFactory.cs index 4ebbb4c..3a2dbab 100644 --- a/Super Polarity/ActorFactory.cs +++ b/Super Polarity/ActorFactory.cs @@ -10,7 +10,7 @@ namespace SuperPolarity { static class ActorFactory { - static internal Game Game; + static internal SuperPolarity Game; static public MainShip CreateMainShip(Vector2 position) { @@ -48,7 +48,7 @@ namespace SuperPolarity return ship; } - internal static void SetGame(Game game) + internal static void SetGame(SuperPolarity game) { ActorFactory.Game = game; } diff --git a/Super Polarity/ActorManager.cs b/Super Polarity/ActorManager.cs index 1b4ef96..8cd265a 100644 --- a/Super Polarity/ActorManager.cs +++ b/Super Polarity/ActorManager.cs @@ -10,9 +10,9 @@ namespace SuperPolarity static class ActorManager { - static Game Game; + static SuperPolarity Game; static int OutlierBounds; - static List Actors; + static IList Actors; static ActorManager() { @@ -50,12 +50,16 @@ namespace SuperPolarity static void CheckActors() { - var i = 0; - foreach (Actor actor in Actors) + for (var i = Actors.Count - 1; i >= 0; i--) { - i++; - foreach (Actor other in Actors.Skip(i)) + if (i >= Actors.Count) { + i = Actors.Count - 1; + } + Actor actor = Actors[i]; + for (var j = i - 1; j >= 0; j--) { + Actor other = Actors[j]; + CheckCollision(actor, other); if (actor.GetType().IsSubclassOf(typeof(Ship)) && other.GetType().IsSubclassOf(typeof(Ship))) @@ -68,6 +72,13 @@ namespace SuperPolarity static void CheckCollision(Actor actor, Actor other) { + var collision = Rectangle.Intersect(actor.Box, other.Box); + var inverseCollision = Rectangle.Intersect(other.Box, actor.Box); + if (!collision.IsEmpty && !actor.Dying && !other.Dying) + { + actor.Collide(other, collision); + other.Collide(actor, inverseCollision); + } } @@ -103,7 +114,7 @@ namespace SuperPolarity } } - internal static void SetGame(Game game) + internal static void SetGame(SuperPolarity game) { Game = game; } diff --git a/Super Polarity/Actors/Actor.cs b/Super Polarity/Actors/Actor.cs index 588ff14..8c71af0 100644 --- a/Super Polarity/Actors/Actor.cs +++ b/Super Polarity/Actors/Actor.cs @@ -10,7 +10,7 @@ namespace SuperPolarity { class Actor { - protected Game game; + protected SuperPolarity game; public List Children; @@ -18,6 +18,9 @@ namespace SuperPolarity protected Texture2D Texture; protected Vector2 Origin; public bool Active; + public Rectangle Box; + protected Vector4 BoxDimensions; + protected Texture2D BoxTexture; // Physical Properties public Vector2 Position; @@ -28,6 +31,13 @@ namespace SuperPolarity // Constraints / Behavior protected float MaxVelocity; protected float AccelerationRate; + protected int HP; + protected bool Immortal; + public bool Dying; + public int Value; + protected Color Color; + + public Actor Parent; public int Width { @@ -39,7 +49,7 @@ namespace SuperPolarity get { return Texture.Height; } } - public Actor(Game newGame) + public Actor(SuperPolarity newGame) { game = newGame; } @@ -58,6 +68,27 @@ namespace SuperPolarity MaxVelocity = 5; AccelerationRate = 10; + + HP = 1; + Immortal = false; + BoxDimensions.X = 20; + BoxDimensions.Y = 20; + BoxDimensions.W = 20; + BoxDimensions.Z = 20; + + Dying = false; + Value = 1; + + InitBox(); + BoxTexture = new Texture2D(game.GraphicsDevice, 1, 1); + BoxTexture.SetData(new Color[] { Color.White }); + + Color = Color.White; + } + + protected void InitBox() + { + Box = new Rectangle((int)(Position.X - BoxDimensions.X), (int)(Position.Y - BoxDimensions.X), (int)(BoxDimensions.X + BoxDimensions.W), (int)(BoxDimensions.Y + BoxDimensions.Z)); } public void AutoDeccelerate(GameTime gameTime) @@ -120,6 +151,13 @@ namespace SuperPolarity Move(gameTime); ChangeAngle(); CheckOutliers(); + UpdateBox(); + } + + protected virtual void UpdateBox() + { + Box.X = (int)(Position.X - BoxDimensions.X); + Box.Y = (int)(Position.Y - BoxDimensions.Y); } public virtual void Move(GameTime gameTime) @@ -167,7 +205,8 @@ namespace SuperPolarity child.Draw(spriteBatch); } - spriteBatch.Draw(Texture, Position, null, Color.White, Angle, Origin, 1f, SpriteEffects.None, 0f); + spriteBatch.Draw(Texture, Position, null, Color, Angle, Origin, 1f, SpriteEffects.None, 0f); + spriteBatch.Draw(BoxTexture, Box, new Color(255, 0, 255, 25)); } void CheckOutliers() @@ -183,5 +222,26 @@ namespace SuperPolarity } } } + + public virtual void Collide(Actor other, Rectangle collision) + { + } + + public void TakeDamage(int amount) + { + if (!Immortal) + { + HP = HP - amount; + if (HP < 0) + { + Die(); + } + } + } + + protected virtual void Die() + { + Dying = true; + } } } diff --git a/Super Polarity/Actors/Bullet.cs b/Super Polarity/Actors/Bullet.cs index 6862e69..5a7be03 100644 --- a/Super Polarity/Actors/Bullet.cs +++ b/Super Polarity/Actors/Bullet.cs @@ -10,8 +10,9 @@ namespace SuperPolarity class Bullet : Actor { protected ParticleEngine particleEngine; + public int Power; - public Bullet(Game newGame) + public Bullet(SuperPolarity newGame) : base(newGame) { } @@ -24,6 +25,11 @@ namespace SuperPolarity public override void Initialize(Texture2D texture, Vector2 position) { base.Initialize(texture, position); + BoxDimensions.X = 10; + BoxDimensions.Y = 10; + BoxDimensions.W = 10; + BoxDimensions.Z = 10; + InitBox(); particleEngine = ParticleEffectFactory.CreateBullet(position); } @@ -32,7 +38,10 @@ namespace SuperPolarity Velocity.X = (float)(MaxVelocity * Math.Cos(Angle)); Velocity.Y = (float)(MaxVelocity * Math.Sin(Angle)); + Power = 1; + Position += Velocity; + UpdateBox(); particleEngine.Update(); particleEngine.EmitterLocation = Position; @@ -43,5 +52,21 @@ namespace SuperPolarity base.Draw(spriteBatch); particleEngine.Draw(spriteBatch); } + + public override void Collide(Actor other, Rectangle collision) + { + if (Dying) { return; } + if (other.GetType().IsAssignableFrom(typeof(StandardShip))) + { + Die(); + return; + } + } + + protected override void Die() + { + ActorManager.CheckOut(this); + Parent.Children.Remove(this); + } } } diff --git a/Super Polarity/Actors/MainShip.cs b/Super Polarity/Actors/MainShip.cs index 1f4f22a..616f16e 100644 --- a/Super Polarity/Actors/MainShip.cs +++ b/Super Polarity/Actors/MainShip.cs @@ -20,7 +20,11 @@ namespace SuperPolarity protected bool Shooting; protected int ShotCooldown; - public MainShip(Game newGame) : base(newGame) {} + protected float CurrentImmortalTime; + protected float MaxImmortalTime; + protected bool Flashing; + + public MainShip(SuperPolarity newGame) : base(newGame) {} ~MainShip() { @@ -38,6 +42,13 @@ namespace SuperPolarity SetPolarity(Polarity.Positive); ShotCooldown = 50; + MaxImmortalTime = 1500; + + BoxDimensions.X = 2; + BoxDimensions.Y = 2; + BoxDimensions.W = 2; + BoxDimensions.Z = 2; + InitBox(); BindInput(); } @@ -57,7 +68,11 @@ namespace SuperPolarity protected void HandleShot(float value) { - Children.Add(ActorFactory.CreateBullet(Position, Angle)); + var bullet = ActorFactory.CreateBullet(Position, Angle); + + Children.Add(bullet); + bullet.Parent = this; + Shooting = true; Timer t = new Timer(new TimerCallback(UnlockShot)); t.Change(ShotCooldown, Timeout.Infinite); @@ -97,6 +112,7 @@ namespace SuperPolarity { base.SwitchPolarity(); SwitchParticleEngine(CurrentPolarity); + game.Player.ResetMultiplier(); } public override void SetPolarity(Polarity newPolarity) @@ -127,9 +143,35 @@ namespace SuperPolarity particleEngine.EmitterLocation = Position; particleEngine.Update(); ConstrainToEdges(); + UpdateImmortality(gameTime); Shooting = false; } + public void UpdateImmortality(GameTime gameTime) + { + if (Immortal) + { + CurrentImmortalTime += gameTime.ElapsedGameTime.Milliseconds; + + if (Flashing) + { + Color = new Color(255, 255, 255, 128); + } + else + { + Color = Color.White; + } + + Flashing = !Flashing; + + if (CurrentImmortalTime > MaxImmortalTime) + { + Immortal = false; + Color = Color.White; + } + } + } + public override void Move(GameTime gameTime) { base.Move(gameTime); @@ -207,5 +249,28 @@ namespace SuperPolarity particleEngine.Draw(spriteBatch); base.Draw(spriteBatch); } + + public override void Collide(Actor other, Rectangle collision) + { + if (other.GetType().IsAssignableFrom(typeof(StandardShip)) && + !Immortal) + { + Die(); + } + } + + protected override void Die() + { + game.Player.Lives = game.Player.Lives - 1; + game.Player.ResetMultiplier(); + if (game.Player.Lives < 0) + { + Dying = true; + } + else { + Immortal = true; + CurrentImmortalTime = 0; + } + } } } diff --git a/Super Polarity/Actors/Ship.cs b/Super Polarity/Actors/Ship.cs index b4706ac..2839c97 100644 --- a/Super Polarity/Actors/Ship.cs +++ b/Super Polarity/Actors/Ship.cs @@ -11,7 +11,6 @@ namespace SuperPolarity { public enum Polarity : byte { Negative, Positive, Neutral }; - protected uint HP; public Polarity CurrentPolarity; public uint MagneticRadius; @@ -22,10 +21,12 @@ namespace SuperPolarity protected bool Magnetizing; - public Ship(Game newGame) : base(newGame) { + public Ship(SuperPolarity newGame) : base(newGame) { MagneticRadius = 250; RepelRadius = 100; + HP = 5; + FleeVelocity = 5; ActVelocity = 2; ChargeVelocity = 1.5f; diff --git a/Super Polarity/Actors/StandardShip.cs b/Super Polarity/Actors/StandardShip.cs index 50a671a..556be0f 100644 --- a/Super Polarity/Actors/StandardShip.cs +++ b/Super Polarity/Actors/StandardShip.cs @@ -20,7 +20,7 @@ namespace SuperPolarity protected Random Random; protected bool AddingAngle; - public StandardShip(Game newGame) : base(newGame) {} + public StandardShip(SuperPolarity newGame) : base(newGame) {} public override void Initialize(Texture2D texture, Vector2 position) { @@ -37,6 +37,8 @@ namespace SuperPolarity RotationFactor = (float) (3 * Math.PI / 180); Random = new Random(BitConverter.ToInt32(cryptoResult, 0)); AddingAngle = true; + + HP = 5; } public override void Magnetize(Ship ship, float distance, float angle) @@ -56,6 +58,7 @@ namespace SuperPolarity } ChangeAngle(); Position += Velocity; + UpdateBox(); Magnetizing = false; } @@ -110,5 +113,33 @@ namespace SuperPolarity Velocity.Y = -Velocity.Y; } } + + public override void Collide(Actor other, Rectangle collision) + { + if (Dying) + { + return; + } + + if (other.GetType() == typeof(MainShip)) + { + Die(); + return; + } + + if (other.GetType() == typeof(Bullet)) + { + var theBullet = (Bullet)other; + TakeDamage(theBullet.Power); + } + } + + protected override void Die() + { + ActorManager.CheckOut(this); + Renderer.CheckOut(this); + game.Player.AddScore(Value); + game.Player.AddMultiplier(1); + } } } diff --git a/Super Polarity/Content/Fonts/SegoeUIMono14.xnb b/Super Polarity/Content/Fonts/SegoeUIMono14.xnb new file mode 100644 index 0000000..51c4abd Binary files /dev/null and b/Super Polarity/Content/Fonts/SegoeUIMono14.xnb differ diff --git a/Super Polarity/GameScreen.cs b/Super Polarity/GameScreen.cs new file mode 100644 index 0000000..4404b16 --- /dev/null +++ b/Super Polarity/GameScreen.cs @@ -0,0 +1,44 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework.Input; + +namespace SuperPolarity +{ + class GameScreen : Screen + { + public GameScreen(SuperPolarity newGame) : base(newGame) {} + + public override void Initialize() + { + InputController.RegisterEventForButton("changePolarity", Buttons.A); + InputController.RegisterEventForKey("changePolarity", Keys.Z); + + InputController.RegisterEventForButton("shoot", Buttons.X); + InputController.RegisterEventForKey("shoot", Keys.X); + } + + public override void LoadContent() + { + Vector2 playerPosition = new Vector2(Game.GraphicsDevice.Viewport.TitleSafeArea.X, Game.GraphicsDevice.Viewport.TitleSafeArea.Y + Game.GraphicsDevice.Viewport.TitleSafeArea.Height / 2); + + Renderer.CheckIn(ActorFactory.CreateMainShip(playerPosition)); + Renderer.CheckIn(ActorFactory.CreateShip(Ship.Polarity.Positive, new Vector2(200, 200))); + Renderer.CheckIn(ActorFactory.CreateShip(Ship.Polarity.Negative, new Vector2(400, 200))); + } + + public override void Update(GameTime gameTime) + { + InputController.UpdateInput(); + ActorManager.Update(gameTime); + } + + public override void Draw(SpriteBatch spriteBatch) + { + Renderer.Draw(spriteBatch); + } + } +} diff --git a/Super Polarity/MenuItem.cs b/Super Polarity/MenuItem.cs new file mode 100644 index 0000000..77561a9 --- /dev/null +++ b/Super Polarity/MenuItem.cs @@ -0,0 +1,11 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace SuperPolarity +{ + class MenuItem : Widget + { + } +} diff --git a/Super Polarity/MenuWidget.cs b/Super Polarity/MenuWidget.cs new file mode 100644 index 0000000..8131e50 --- /dev/null +++ b/Super Polarity/MenuWidget.cs @@ -0,0 +1,11 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace SuperPolarity +{ + class MenuWidget : Widget + { + } +} diff --git a/Super Polarity/Player.cs b/Super Polarity/Player.cs new file mode 100644 index 0000000..25e66da --- /dev/null +++ b/Super Polarity/Player.cs @@ -0,0 +1,46 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace SuperPolarity +{ + public class Player + { + public int Score; + public int Multiplier; + public int Lives; + + public Player() + { + Score = 0; + Multiplier = 1; + Lives = 3; + } + + public void AddScore(int value) + { + Score = Score + (value * Multiplier); + } + + public void AddMultiplier(int value) + { + Multiplier = Multiplier + 1; + } + + public void ResetMultiplier() + { + Multiplier = 1; + } + + public void Draw() + { + + } + + public void Update() + { + + } + } +} diff --git a/Super Polarity/ScoreScreen.cs b/Super Polarity/ScoreScreen.cs new file mode 100644 index 0000000..b96ae9b --- /dev/null +++ b/Super Polarity/ScoreScreen.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace SuperPolarity +{ + class ScoreScreen : Screen + { + public ScoreScreen(SuperPolarity newGame) : base(newGame) {} + + public override void Initialize() + { + } + } +} diff --git a/Super Polarity/Screen.cs b/Super Polarity/Screen.cs new file mode 100644 index 0000000..8cea5c9 --- /dev/null +++ b/Super Polarity/Screen.cs @@ -0,0 +1,38 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; + +namespace SuperPolarity +{ + class Screen + { + protected SuperPolarity Game; + public Screen(SuperPolarity game) + { + Game = game; + } + + public virtual void Update(GameTime gameTime) + { + } + + public virtual void Draw(SpriteBatch spriteBatch) + { + } + + public virtual void LoadContent() + { + } + + public virtual void Initialize() + { + } + + public virtual void CleanUp() + { + } + } +} diff --git a/Super Polarity/ScreenManager.cs b/Super Polarity/ScreenManager.cs new file mode 100644 index 0000000..04c10a4 --- /dev/null +++ b/Super Polarity/ScreenManager.cs @@ -0,0 +1,48 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; + +namespace SuperPolarity +{ + static class ScreenManager + { + static Stack Screens; + static SuperPolarity Game; + + static ScreenManager() + { + Screens = new Stack(); + } + + static public void Push(Screen screen) + { + Screens.Push(screen); + } + + static public void Pop() + { + Screens.Pop(); + } + + static public void Update(GameTime gameTime) + { + Screens.Peek().Update(gameTime); + } + + static public void Draw(SpriteBatch spriteBatch) + { + foreach (Screen screen in Screens) + { + screen.Draw(spriteBatch); + } + } + + internal static void SetGame(SuperPolarity game) + { + Game = game; + } + } +} diff --git a/Super Polarity/Super Polarity.csproj b/Super Polarity/Super Polarity.csproj index 193edde..2cd1d08 100644 --- a/Super Polarity/Super Polarity.csproj +++ b/Super Polarity/Super Polarity.csproj @@ -39,17 +39,26 @@ + + + + + + + + + @@ -78,6 +87,9 @@ + + Always + Always diff --git a/Super Polarity/SuperPolarity.cs b/Super Polarity/SuperPolarity.cs index 21d1ed4..6689167 100644 --- a/Super Polarity/SuperPolarity.cs +++ b/Super Polarity/SuperPolarity.cs @@ -17,20 +17,33 @@ namespace SuperPolarity /// public class SuperPolarity : Game { - public static GraphicsDeviceManager graphics; + public GraphicsDeviceManager graphics; SpriteBatch spriteBatch; public static int OutlierBounds; + public Player Player; + + Screen EntryScreen; + + SpriteFont DebugFont; + public SuperPolarity() : base() { - SuperPolarity.graphics = new GraphicsDeviceManager(this); - SuperPolarity.graphics.PreferMultiSampling = true; + graphics = new GraphicsDeviceManager(this); + graphics.PreferMultiSampling = true; + graphics.PreferredBackBufferWidth = 1280; + graphics.PreferredBackBufferHeight = 720; + graphics.ToggleFullScreen(); + Content.RootDirectory = "Content"; ActorFactory.SetGame(this); ParticleEffectFactory.SetGame(this); ActorManager.SetGame(this); + ScreenManager.SetGame(this); + + EntryScreen = (Screen)new GameScreen(this); } /// @@ -43,13 +56,19 @@ namespace SuperPolarity { base.Initialize(); - OutlierBounds = 100; + InputController.RegisterEventForKey("fullScreenToggle", Keys.F11); + InputController.Bind("fullScreenToggle", HandleFullScreenToggle); - InputController.RegisterEventForButton("changePolarity", Buttons.A); - InputController.RegisterEventForKey("changePolarity", Keys.Z); + EntryScreen.Initialize(); + ScreenManager.Push(EntryScreen); - InputController.RegisterEventForButton("shoot", Buttons.X); - InputController.RegisterEventForKey("shoot", Keys.X); + OutlierBounds = 100; + } + + protected void HandleFullScreenToggle(float value) + { + graphics.ToggleFullScreen(); + graphics.ApplyChanges(); } /// @@ -61,11 +80,10 @@ namespace SuperPolarity // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); - Vector2 playerPosition = new Vector2(GraphicsDevice.Viewport.TitleSafeArea.X, GraphicsDevice.Viewport.TitleSafeArea.Y + GraphicsDevice.Viewport.TitleSafeArea.Height / 2); + EntryScreen.LoadContent(); - Renderer.CheckIn(ActorFactory.CreateMainShip(playerPosition)); - Renderer.CheckIn(ActorFactory.CreateShip(Ship.Polarity.Positive, new Vector2(200, 200))); - Renderer.CheckIn(ActorFactory.CreateShip(Ship.Polarity.Negative, new Vector2(400, 200))); + Player = new Player(); + DebugFont = Content.Load("Fonts\\SegoeUIMono14"); } /// @@ -87,10 +105,7 @@ namespace SuperPolarity if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape)) Exit(); - // TODO: Add your update logic here - - InputController.UpdateInput(); - ActorManager.Update(gameTime); + ScreenManager.Update(gameTime); base.Update(gameTime); } @@ -105,7 +120,11 @@ namespace SuperPolarity spriteBatch.Begin(); - Renderer.Draw(spriteBatch); + ScreenManager.Draw(spriteBatch); + + spriteBatch.DrawString(DebugFont, "Score: " + Player.Score.ToString(), new Vector2(10, 10), Color.LightGray); + spriteBatch.DrawString(DebugFont, "Multiplier: " + Player.Multiplier.ToString(), new Vector2(10, 30), Color.LightGray); + spriteBatch.DrawString(DebugFont, "Lives: " + Player.Lives.ToString(), new Vector2(10, 50), Color.LightGray); spriteBatch.End(); diff --git a/Super Polarity/TitleScreen.cs b/Super Polarity/TitleScreen.cs new file mode 100644 index 0000000..5b33218 --- /dev/null +++ b/Super Polarity/TitleScreen.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace SuperPolarity +{ + class TitleScreen : Screen + { + public TitleScreen(SuperPolarity newGame) : base(newGame) {} + } +} diff --git a/Super Polarity/Widget.cs b/Super Polarity/Widget.cs new file mode 100644 index 0000000..65c3fd2 --- /dev/null +++ b/Super Polarity/Widget.cs @@ -0,0 +1,58 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace SuperPolarity +{ + class Widget + { + public IList Children; + public Dictionary>> Listeners; + + public virtual void AppendChild(Widget widget) + { + Children.Add(widget); + } + + public virtual void Bind(string eventName, Action eventListener) + { + List> newListenerList; + List> listenerList; + bool foundListeners; + + if (!Listeners.ContainsKey(eventName)) + { + newListenerList = new List>(); + Listeners.Add(eventName, newListenerList); + } + + foundListeners = Listeners.TryGetValue(eventName, out listenerList); + + listenerList.Add(eventListener); + } + + public virtual void Unbind(string eventName, Action eventListener) + { + // NOT YET IMPLEMENTED; + } + + public virtual void Dispatch(string eventName, float value) + { + List> listenerList; + bool foundListeners; + + foundListeners = Listeners.TryGetValue(eventName, out listenerList); + + if (!foundListeners) + { + return; + } + + foreach (Action method in listenerList) + { + method(value); + } + } + } +} diff --git a/Super Polarity/bin/WindowsGL/Debug/Super Polarity.exe b/Super Polarity/bin/WindowsGL/Debug/Super Polarity.exe index 906274f..0612174 100644 Binary files a/Super Polarity/bin/WindowsGL/Debug/Super Polarity.exe and b/Super Polarity/bin/WindowsGL/Debug/Super Polarity.exe differ diff --git a/Super Polarity/bin/WindowsGL/Debug/Super Polarity.pdb b/Super Polarity/bin/WindowsGL/Debug/Super Polarity.pdb index 837ce9b..670745d 100644 Binary files a/Super Polarity/bin/WindowsGL/Debug/Super Polarity.pdb and b/Super Polarity/bin/WindowsGL/Debug/Super Polarity.pdb differ diff --git a/Super Polarity/obj/x86/Debug/DesignTimeResolveAssemblyReferencesInput.cache b/Super Polarity/obj/x86/Debug/DesignTimeResolveAssemblyReferencesInput.cache index c87641f..c7e2aaa 100644 Binary files a/Super Polarity/obj/x86/Debug/DesignTimeResolveAssemblyReferencesInput.cache and b/Super Polarity/obj/x86/Debug/DesignTimeResolveAssemblyReferencesInput.cache differ diff --git a/Super Polarity/obj/x86/Debug/Super Polarity.csproj.FileListAbsolute.txt b/Super Polarity/obj/x86/Debug/Super Polarity.csproj.FileListAbsolute.txt index aa6ffb3..9c92990 100644 --- a/Super Polarity/obj/x86/Debug/Super Polarity.csproj.FileListAbsolute.txt +++ b/Super Polarity/obj/x86/Debug/Super Polarity.csproj.FileListAbsolute.txt @@ -28,3 +28,4 @@ C:\Users\Miau\documents\visual studio 2010\Projects\Super Polarity\Super Polarit C:\Users\Miau\documents\visual studio 2010\Projects\Super Polarity\Super Polarity\bin\WindowsGL\Debug\Content\Graphics\star.xnb C:\Users\Miau\documents\visual studio 2010\Projects\Super Polarity\Super Polarity\bin\WindowsGL\Debug\Content\Graphics\negative-ship.xnb C:\Users\Miau\documents\visual studio 2010\Projects\Super Polarity\Super Polarity\bin\WindowsGL\Debug\Content\Graphics\square.xnb +C:\Users\Miau\documents\visual studio 2010\Projects\Super Polarity\Super Polarity\bin\WindowsGL\Debug\Content\Fonts\SegoeUIMono14.xnb diff --git a/Super Polarity/obj/x86/Debug/Super Polarity.exe b/Super Polarity/obj/x86/Debug/Super Polarity.exe index 906274f..0612174 100644 Binary files a/Super Polarity/obj/x86/Debug/Super Polarity.exe and b/Super Polarity/obj/x86/Debug/Super Polarity.exe differ diff --git a/Super Polarity/obj/x86/Debug/Super Polarity.pdb b/Super Polarity/obj/x86/Debug/Super Polarity.pdb index 837ce9b..670745d 100644 Binary files a/Super Polarity/obj/x86/Debug/Super Polarity.pdb and b/Super Polarity/obj/x86/Debug/Super Polarity.pdb differ