/// <summary> /// A constructor that takes an image and returns a SpriteImage object /// /// </summary> /// <param name="image">the image this object will draw</param> public SimpleSpriteImage(Texture2D image) { this.image = image; if (image != null) { //HACK: need to move image handlign above tilemap sprite in hirearchy collider = new BoxCollider(new Vector2(image.Width, image.Height)); } }
/// <summary> /// This creates a sprite image with the passed in image strip, frame size and /// frame coordinates /// </summary> /// <param name="parent">The parent scene graph object</param> /// <param name="image">The image to draw for the sprite</param> /// <param name="frameSize">The width and height of each frame in the strip</param> public AnimatedSpriteImage(Texture2D image, Rectangle[] frames, float secPerFrame) { this.image = image; this.frames = frames; this.secPerFrame = secPerFrame; this.collider = new BoxCollider(); ResetColliderSize(); }