From ced3d03bdb3ce866d832e03fb212865140905a9a Mon Sep 17 00:00:00 2001 From: Thomas Leyh Date: Sun, 24 Jul 2016 08:14:18 +0200 Subject: Add project files. --- V3/Objects/Transformation.cs | 102 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 V3/Objects/Transformation.cs (limited to 'V3/Objects/Transformation.cs') diff --git a/V3/Objects/Transformation.cs b/V3/Objects/Transformation.cs new file mode 100644 index 0000000..1b1cf86 --- /dev/null +++ b/V3/Objects/Transformation.cs @@ -0,0 +1,102 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Content; +using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework.Input; + +namespace V3.Objects +{ + // ReSharper disable once ClassNeverInstantiated.Global + public sealed class Transformation + { + public IObjectsManager ObjectsManager { private get; set; } + private KeyboardState mOldStateSpecialattack; + private KeyboardState mOldStateZombie; + private KeyboardState mOldStateMeatball; + private KeyboardState mOldStateSkeleton; + private KeyboardState mOldStateHorse; + internal Selection mSelection; + private Texture2D mNecroArea; + + /// + /// Call for transformations + /// + public void Transform() + { + KeyboardState newState = Keyboard.GetState(); + + // Specialattack for Meatball (press 1) + if (newState.IsKeyDown(Keys.D1)) + { + if (!mOldStateSpecialattack.IsKeyDown(Keys.D1)) + { + mSelection.Specialattack(); + } + } + mOldStateSpecialattack = newState; + + // Transform Zombie (press 2) + if (newState.IsKeyDown(Keys.D2)) + { + if (!mOldStateZombie.IsKeyDown(Keys.D2)) + { + mSelection.TransformZombie(); + } + } + mOldStateZombie = newState; + + // Transform Meatball (press 3) + // Nneed five zombies + if (newState.IsKeyDown(Keys.D3)) + { + if (!mOldStateMeatball.IsKeyDown(Keys.D3)) + { + mSelection.TransformMeatball(); + } + } + mOldStateMeatball = newState; + + // Transform Skeleton (press 4) + // Need one zombie + if (newState.IsKeyDown(Keys.D4)) + { + if (!mOldStateSkeleton.IsKeyDown(Keys.D4)) + { + mSelection.TransformSkeleton(); + } + } + mOldStateSkeleton = newState; + + // Transform SkeletonHorse (press 5) + // Nneed 3 skeletons + if (newState.IsKeyDown(Keys.D5)) + { + if (!mOldStateHorse.IsKeyDown(Keys.D5)) + { + mSelection.TransformSkeletonHorse(); + } + } + mOldStateHorse = newState; + } + + //Draw(SpriteBatch spriteBatch, Vector2 position, MovementState movementState, MovementDirection movementDirection) + /// + /// Load the selection and ellipse sprites for necromancers area + /// + /// the content manager + public void LoadArea(ContentManager contentManager) + { + //mNecroArea = contentManager.Load("Sprites/selection"); + mNecroArea = contentManager.Load("Sprites/ellipse"); + } + + /// + /// Draw the area for necromancer + /// + /// the sprite batch to use for drawing the object + public void DrawNecroArea(SpriteBatch spriteBatch) + { + //spriteBatch.Draw(mNecroArea, ObjectsManager.PlayerCharacter.Position - new Vector2(800, 400), null, Color.Red*0.3f, 0, Vector2.Zero, 25, SpriteEffects.None, 0); + spriteBatch.Draw(mNecroArea, ObjectsManager.PlayerCharacter.Position - new Vector2(640, 320), null, Color.Red*0.5f, 0, Vector2.Zero, 2.5f, SpriteEffects.None, 0); + } + } +} \ No newline at end of file -- cgit v1.2.1