public void SetTile(State state, Motion motion, Vector2 position, Texture2D tileSheet, Rectangle tileArea) { this.state = state; this.motion = motion; this.position = position; increase = true; moveSpeed = 100f; tileImage = CropImage(tileSheet, tileArea); range = 50; counter = 0; animation = new Animation(); animation.LoadContent(ScreenManager.Instance.Content, tileImage, "", position); containsEntity = false; velocity = Vector2.Zero; }
public virtual void LoadContent(ContentManager content, List<string> attributes, List<string> contents, InputManager input) { this.content = new ContentManager(content.ServiceProvider, "Content"); moveAnimation = new Animation(); ssAnimation = new SpriteSheetAnimation(); for (int i = 0; i < attributes.Count; i++) { switch (attributes[i]) { case "Health": health = int.Parse(contents[i]); break; case "Frames": string[] frames = contents[i].Split(','); moveAnimation.Frames = new Vector2(int.Parse(frames[0]), int.Parse(frames[1])); break; case "Image": image = this.content.Load<Texture2D>(contents[i]); break; case "Position": frames = contents[i].Split(','); position = new Vector2(int.Parse(frames[0]), int.Parse(frames[1])); break; case "MoveSpeed": moveSpeed = float.Parse(contents[i]); break; case "Range": range = int.Parse(contents[i]); break; } } gravity = 100f; velocity = Vector2.Zero; syncTilePostion = false; activateGravity = true; moveAnimation.LoadContent(content, image, "", position); }