//-------------------------------------------------------------------------------------
        // Class constructors

        public SmokeParticleObject(FireAndSmokeGame game, Texture2D texture, Vector3 position, Vector3 scale)
            : base(game, texture, position, scale)
        {
            _game = game;

            // Have we already built the ground vertex array in a previous instance?
            if (_vertices == null)
            {
                // No, so build it now
                BuildVertices();
                // Create a vertex buffer
                _vertexBuffer = new VertexBuffer(game.GraphicsDevice, typeof(VertexPositionNormalTexture), _vertices.Length, BufferUsage.WriteOnly);
                _vertexBuffer.SetData(_vertices);
            }

            // Set object properties
            ObjectTexture = texture;

            // Store the supplied start position
            _startPosition = position;
            _startScale    = scale;

            // Reset the particle to an initial state
            ResetParticle();
        }
        // Constructor
        public GamePage()
        {
            InitializeComponent();

            _game = XamlGame <FireAndSmokeGame> .Create("", this);

            // Sample code to localize the ApplicationBar
            //BuildLocalizedApplicationBar();
        }
        //-------------------------------------------------------------------------------------
        // Class constructors

        public GroundObject(FireAndSmokeGame game, Texture2D texture)
            : base(game)
        {
            // Have we already built the ground vertex array in a previous instance?
            if (_vertices == null)
            {
                // No, so build it now
                BuildVertices();
            }

            // Set other object properties
            ObjectTexture = texture;
        }
        //-------------------------------------------------------------------------------------
        // Class constructors

        public FireParticleObject(FireAndSmokeGame game, Texture2D texture, Vector3 position, Vector3 scale)
            : base(game, texture, position, scale)
        {
            _game = game;

            // Have we already built the ground vertex array in a previous instance?
            if (_vertices == null)
            {
                // No, so build it now
                BuildVertices();
                // Create a vertex buffer
                _vertexBuffer = new VertexBuffer(game.GraphicsDevice, typeof(VertexPositionNormalTexture), _vertices.Length, BufferUsage.WriteOnly);
                _vertexBuffer.SetData(_vertices);
            }

            // Maximum height
            _yMax = GameHelper.RandomNext(0.4f, 0.8f);

            // Offset the position to randomize around the center of the fire
            PositionX += GameHelper.RandomNext(-0.1f, 0.1f);
            PositionY += GameHelper.RandomNext(0.0f, _yMax);
            PositionZ += GameHelper.RandomNext(-0.1f, 0.1f);

            // Random start speed
            _yVelocity = GameHelper.RandomNext(0.0f, 0.0002f);

            // Random angle
            AngleZ       = GameHelper.RandomNext(0, MathHelper.TwoPi);
            _rotateSpeed = MathHelper.ToRadians(GameHelper.RandomNext(-5.0f, 5.0f));

            // Set a random color between yellow and red or red and white
            if (GameHelper.RandomNext(2) == 0)
            {
                ObjectColor = new Color(255, GameHelper.RandomNext(128, 256), 0);
            }
            else
            {
                ObjectColor = new Color(255, 255, GameHelper.RandomNext(256));
            }
        }
Example #5
0
        //-------------------------------------------------------------------------------------
        // Class constructors

        public CameraObject(FireAndSmokeGame game)
            : base(game)
        {
        }