Adding visible property to SimpleDrawableAxiosGameObject

This commit is contained in:
Nathan Adams 2012-09-22 20:37:41 -05:00
parent d73c59bcce
commit 8b4192a5d3

View File

@ -19,6 +19,13 @@ namespace Axios.Engine
protected Boolean _adjustunits = true; protected Boolean _adjustunits = true;
protected Boolean _relativetocamera = true; protected Boolean _relativetocamera = true;
protected int _draworder; protected int _draworder;
protected bool _visible = true;
public bool Visible
{
get { return _visible; }
set { this._visible = value; }
}
@ -38,16 +45,18 @@ namespace Axios.Engine
public virtual void Draw(AxiosGameScreen gameScreen, GameTime gameTime) public virtual void Draw(AxiosGameScreen gameScreen, GameTime gameTime)
{ {
if (_visible)
if (_relativetocamera) {
gameScreen.ScreenManager.SpriteBatch.Begin(0, null, null, null, null, null, gameScreen.Camera.View); if (_relativetocamera)
else gameScreen.ScreenManager.SpriteBatch.Begin(0, null, null, null, null, null, gameScreen.Camera.View);
gameScreen.ScreenManager.SpriteBatch.Begin(); else
if (_adjustunits) gameScreen.ScreenManager.SpriteBatch.Begin();
DrawObject(gameScreen.ScreenManager.SpriteBatch, Texture, BodyPart, Origin, true, _scale); if (_adjustunits)
else DrawObject(gameScreen.ScreenManager.SpriteBatch, Texture, BodyPart, Origin, true, _scale);
DrawObject(gameScreen.ScreenManager.SpriteBatch, Texture, BodyPart, Origin, _scale); else
gameScreen.ScreenManager.SpriteBatch.End(); DrawObject(gameScreen.ScreenManager.SpriteBatch, Texture, BodyPart, Origin, _scale);
gameScreen.ScreenManager.SpriteBatch.End();
}
} }
protected void DrawObject(SpriteBatch sb, Texture2D texture, Body body, Vector2 origin) protected void DrawObject(SpriteBatch sb, Texture2D texture, Body body, Vector2 origin)