ConvertTileIndexToWorldPosition() public method

public ConvertTileIndexToWorldPosition ( float x, float y ) : Vector2
x float
y float
return Vector2
Ejemplo n.º 1
0
        public void Draw(GameTime gameTime, Vector2 targetIndex)
        {
            Dictionary <Vector2, double> affectedWorldIndices = GetAffectedWorldIndices(targetIndex);

            foreach (KeyValuePair <Vector2, double> x in affectedWorldIndices)
            {
                Vector2 worldPosition  = _world.ConvertTileIndexToWorldPosition(x.Key.X, x.Key.Y);
                Vector2 screenPosition = Camera.GetScreenPosition(worldPosition);
                Color   color          = new Color(new Vector4(1, 1, 1, (float)x.Value));
                GraphicsHelper.spriteBatch.Draw(_affectedTileImage, screenPosition, null, color, 0f, new Vector2(0, 0), 1f, SpriteEffects.None, 0.6f);
            }
        }
Ejemplo n.º 2
0
        public void Draw(GameTime gameTime)
        {
            if (_world.PlayerHasExploredWorldIndex(WorldIndex))
            {
                Vector2 worldPosition  = _world.ConvertTileIndexToWorldPosition(WorldIndex.X, WorldIndex.Y);
                Vector2 screenPosition = Camera.GetScreenPosition(worldPosition);

                if (IsOpen)
                {
                    GraphicsHelper.spriteBatch.Draw(_openImage, screenPosition, null, Color.White, 0f, new Vector2(0, 0), 1f, SpriteEffects.None, 0.7f);
                }
                else
                {
                    GraphicsHelper.spriteBatch.Draw(_closedImage, screenPosition, null, Color.White, 0f, new Vector2(0, 0), 1f, SpriteEffects.None, 0.7f);
                }
            }
        }