public override void LoadContent(ContentManager content, InputManager inputManager) { base.LoadContent(content, inputManager); fileManager = new FileManager(); moveAnimation = new SpriteSheetAnimation(); Vector2 tempFrames = Vector2.Zero; fileManager.LoadContent("Load/Player.cme", attributes, contents); for (int i=0; i < attributes.Count; i++) { for (int j = 0; j < attributes[i].Count; j++) { switch (attributes[i][j]) { case "Health": health = int.Parse(contents[i][j]); break; case "Frames": string[] frames = contents[i][j].Split(' '); tempFrames = new Vector2(int.Parse(frames[0]), int.Parse(frames[1])); break; case "Image": image = this.content.Load<Texture2D>(contents[i][j]); break; case "Position": frames = contents[i][j].Split(' '); position = new Vector2(int.Parse(frames[0]), int.Parse(frames[1])); break; } } } moveAnimation.LoadContent(content, image, "", position); }
public virtual void UnloadContent() { content.Unload(); inputManager = null; attributes.Clear(); contents.Clear(); }
public virtual void LoadContent(ContentManager Content, InputManager inputManager) { content = new ContentManager(Content.ServiceProvider, "Content"); attributes = new List<List<string>>(); contents = new List<List<string>>(); this.inputManager = inputManager; }
public override void LoadContent(ContentManager Content, InputManager inputManager) { base.LoadContent(Content, inputManager); if (font == null) font = this.content.Load<SpriteFont>("Fonts/Header"); menu = new MenuManager(); menu.LoadContent(content, "Title"); }
public void AddScreen(GameScreen screen, InputManager inputManager) { transition = true; newScreen = screen; fade.IsActive = true; fade.Alpha = 0.0f; fade.ActivateValue = 1.0f; this.inputManager = inputManager; }
public override void Update(GameTime gameTime, InputManager input) { moveAnimation.IsActive = true; if (input.KeyDown(Keys.Right, Keys.D)) moveAnimation.CurrentFrame = new Vector2(moveAnimation.CurrentFrame.X, 2); else if (input.KeyDown(Keys.Left, Keys.A)) moveAnimation.CurrentFrame = new Vector2(moveAnimation.CurrentFrame.X, 1); else moveAnimation.IsActive = false; moveAnimation.Update(gameTime); }
public override void LoadContent(ContentManager Content, InputManager inputManager) { base.LoadContent(Content, inputManager); if (font == null) font = content.Load<SpriteFont>("Fonts/Header"); if (Menu == null) Menu = content.Load<SpriteFont>("Fonts/Menu"); imageNumber = 0; fileManager = new FileManager(); fade = new List<FadeAnimation>(); images = new List<Texture2D>(); fileManager.LoadContent("Load/splash.cme", attributes, contents); for(int i = 0; i < attributes.Count; i++) { for(int j = 0; j < attributes[i].Count; j++) { switch (attributes[i][j]) { case "Image": images.Add(content.Load<Texture2D>(contents[i][j])); fade.Add(new FadeAnimation()); break; // case "Sound": // sounds.Add(content.Load<SoundEffect>(contents[i][j])); // break; } } } for (int i = 0; i < fade.Count; i++) { //ImageWidth / 2 * scale - (imageWidth / 2) //ImageHeight / 2 * scale - (imageHeight / 2) fade[i].LoadContent(content, images[i], "", Vector2.Zero); fade[i].Scale = 1.0f; fade[i].IsActive = true; } }
public virtual void Update(GameTime gameTime, InputManager input) { }
public void AddScreen(GameScreen screen, InputManager inputManager, float alpha) { transition = true; newScreen = screen; fade.IsActive = true; fade.ActivateValue = 1.0f; if (alpha != 1.0f) fade.Alpha = 1.0f - alpha; else fade.Alpha = alpha; fade.Increase = true; this.inputManager = inputManager; }
public void Initialize() { currentScreen = new SplashScreen(); fade = new FadeAnimation(); inputManager = new InputManager(); }
public override void LoadContent(ContentManager Content, InputManager inputManager) { base.LoadContent(Content, inputManager); player = new Player(); player.LoadContent(content, inputManager); }
public override void LoadContent(ContentManager content, InputManager inputManager) { base.LoadContent(content, inputManager); }
public void Update(GameTime gameTime, InputManager inputManager) { if (axis == 1) { if (inputManager.KeyPressed(Keys.Right, Keys.D)) itemNumber++; else if (inputManager.KeyPressed(Keys.Left, Keys.A)) itemNumber--; } else { if (inputManager.KeyPressed(Keys.Down, Keys.S)) itemNumber++; else if (inputManager.KeyPressed(Keys.Up, Keys.W)) itemNumber--; } if (inputManager.KeyPressed(Keys.Enter, Keys.Z)) { if (linkType[itemNumber] == "Screen") { Type newClass = Type.GetType("FirstTry_2D_Game."+ linkID[itemNumber]); ScreenManager.Instance.AddScreen((GameScreen)Activator.CreateInstance(newClass), inputManager); } } if (itemNumber < 0) itemNumber = 0; else if (itemNumber > menuItems.Count - 1) itemNumber = menuItems.Count - 1; for(int i = 0; i < animation.Count; i++) { for(int j = 0; j < animation[i].Count; j++) { if (itemNumber == i) animation[i][j].IsActive = true; else animation[i][j].IsActive = false; animation[i][j].Update(gameTime); } } }