public GamePage(string launchArguments)
        {
            this.InitializeComponent();

            // Create the game.
            _game = XamlGame <CosmicRocksPartIGame> .Create(launchArguments, Window.Current.CoreWindow, this);
        }
        //-------------------------------------------------------------------------------------
        // Class constructors

        internal SpaceshipObject(CosmicRocksPartIGame game, Texture2D texture, Vector2 position)
            : base(game, position, texture)
        {
            // Store a strongly-typed reference to the game
            _game = game;

            // Set the origin
            Origin = new Vector2(texture.Width, texture.Height) / 2;

            // Set the scale
            Scale = new Vector2(0.2f, 0.2f);

            // We are not (yet) exploding
            ExplosionUpdateCount = 0;
        }
示例#3
0
        //-------------------------------------------------------------------------------------
        // Class constructors

        internal StarObject(CosmicRocksPartIGame game, Texture2D texture)
            : base(game, Vector2.Zero, texture)
        {
            // Store a strongly-typed reference to the game
            _game = game;

            // Set a random position
            PositionX = GameHelper.RandomNext(0, _game.GraphicsDevice.Viewport.Bounds.Width);
            PositionY = GameHelper.RandomNext(0, _game.GraphicsDevice.Viewport.Bounds.Height);

            // Set the origin
            Origin = new Vector2(texture.Width, texture.Height) / 2;

            // Set the scale range
            _scaleMin = GameHelper.RandomNext(0.1f, 0.6f);
            _scaleMax = _scaleMin + GameHelper.RandomNext(0.1f, 0.4f);
        }
        //-------------------------------------------------------------------------------------
        // Class constructors

        internal RockObject(CosmicRocksPartIGame game, Texture2D texture, int generation, float size, float speed)
            : base(game, Vector2.Zero, texture)
        {
            // Store a strongly-typed reference to the game
            _game = game;

            // Set a random position
            PositionX = GameHelper.RandomNext(0, _game.GraphicsDevice.Viewport.Bounds.Width);
            PositionY = GameHelper.RandomNext(0, _game.GraphicsDevice.Viewport.Bounds.Height);

            // Set the origin
            Origin = new Vector2(texture.Width, texture.Height) / 2;

            // Store the other constructor parameters
            _constructorSpeed = speed;
            _generation       = generation;

            // Initialize the remainder of the rock properties
            InitializeRock(size);
        }