/// <summary> /// Animated GameObject constructor /// </summary> /// <param name="texturename">Name of texture in the Textures static class</param> /// <param name="width">Frame/object width</param> /// <param name="height">Frame/object height</param> public GameObject(string texturename,int width,int height) : this(texturename) { _width=width; _height=height; _animation=new Animation(this,width,height); UpdateRect(); }
/// <summary> /// GameObject basic constructor /// </summary> /// <param name="texturename">Name of texture in the Textures static class</param> public GameObject(string texturename) { _id=_ID; _ID++; _pos=Vector2.Zero; _rotation=0; Colour=Color.White; ChangeTexture(texturename); _srcRect=new Rectangle(0,0,_texture.Width,_texture.Height); _spriteEffect=SpriteEffects.None; _animation=null; _scale=1; _transform=new Matrix(); _scaled=false; UpdateRect(); }
/// <summary> /// Runs a cleanup of the object /// </summary> protected virtual void CleanUp() { if (_animation!=null) { _animation.Remove(); _animation=null; } }