From 8b4192a5d3046edb030b9dd693bbc654060fd4a0 Mon Sep 17 00:00:00 2001 From: Nathan Adams Date: Sat, 22 Sep 2012 20:37:41 -0500 Subject: [PATCH] Adding visible property to SimpleDrawableAxiosGameObject --- axios/Engine/SimpleDrawableAxiosGameObject.cs | 29 ++++++++++++------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/axios/Engine/SimpleDrawableAxiosGameObject.cs b/axios/Engine/SimpleDrawableAxiosGameObject.cs index 826f8e9..f0d8cb7 100644 --- a/axios/Engine/SimpleDrawableAxiosGameObject.cs +++ b/axios/Engine/SimpleDrawableAxiosGameObject.cs @@ -19,6 +19,13 @@ namespace Axios.Engine protected Boolean _adjustunits = true; protected Boolean _relativetocamera = true; 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) { - - if (_relativetocamera) - gameScreen.ScreenManager.SpriteBatch.Begin(0, null, null, null, null, null, gameScreen.Camera.View); - else - gameScreen.ScreenManager.SpriteBatch.Begin(); - if (_adjustunits) - DrawObject(gameScreen.ScreenManager.SpriteBatch, Texture, BodyPart, Origin, true, _scale); - else - DrawObject(gameScreen.ScreenManager.SpriteBatch, Texture, BodyPart, Origin, _scale); - gameScreen.ScreenManager.SpriteBatch.End(); + if (_visible) + { + if (_relativetocamera) + gameScreen.ScreenManager.SpriteBatch.Begin(0, null, null, null, null, null, gameScreen.Camera.View); + else + gameScreen.ScreenManager.SpriteBatch.Begin(); + if (_adjustunits) + DrawObject(gameScreen.ScreenManager.SpriteBatch, Texture, BodyPart, Origin, true, _scale); + else + DrawObject(gameScreen.ScreenManager.SpriteBatch, Texture, BodyPart, Origin, _scale); + gameScreen.ScreenManager.SpriteBatch.End(); + } } protected void DrawObject(SpriteBatch sb, Texture2D texture, Body body, Vector2 origin)