当前位置: 首页>>代码示例>>C#>>正文


C# Camera2D.GetParallaxMatrix方法代码示例

本文整理汇总了C#中Camera2D.GetParallaxMatrix方法的典型用法代码示例。如果您正苦于以下问题:C# Camera2D.GetParallaxMatrix方法的具体用法?C# Camera2D.GetParallaxMatrix怎么用?C# Camera2D.GetParallaxMatrix使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Camera2D的用法示例。


在下文中一共展示了Camera2D.GetParallaxMatrix方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: UpdateParallax

        public void UpdateParallax(Camera2D _camera)
        {
            Matrix pos = _camera.GetParallaxMatrix(_speed);
            if (_camera.IsPlayerFollow)
            {
                _position.X = -pos.M41 - (int)-pos.M41 % _width;
                _position2.X = _position.X + _width;
            }
            else
            {
                if (-pos.M41 > _position2.X + -_camera.Translation.X &&
                    -pos.M41 < _position2.X + _width)
                    _position.X = _position2.X + _width;
                else
                    _position.X = _position2.X - _width;

                if (-pos.M41 > _position.X + -_camera.Translation.X &&
                    -pos.M41 < _position.X + _width)
                    _position2.X = _position.X + _width;
                else
                    _position2.X = _position.X - _width;
            }

            _position.Y = -pos.M42;
            _position2.Y = -pos.M42;
        }
开发者ID:TheEternalCircle,项目名称:TheEternalCircleMasterSolution,代码行数:26,代码来源:HParallax.cs

示例2: DrawParallax

        protected void DrawParallax(SpriteBatch spriteBatch, Camera2D _camera)
        {
            spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied, null, null, null, null, _camera.GetParallaxMatrix(_speed));

            spriteBatch.Draw(TextureManager.Instance.GetParallax(_textureName), _position, Color.White);
            spriteBatch.Draw(TextureManager.Instance.GetParallax(_textureName), _position2, Color.White);

            spriteBatch.End();
        }
开发者ID:TheEternalCircle,项目名称:TheEternalCircleMasterSolution,代码行数:9,代码来源:HBackground.cs

示例3: Draw

        public void Draw(SpriteBatch spriteBatch, Camera2D pCamera)
        {
            if (_textureName == "") return;

            spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied, null, null, null, null, pCamera.GetParallaxMatrix(_speed));

            spriteBatch.Draw(TextureManager.Instance.GetParallax(_textureName), _position, Color.White);
            if(!_isMoving)
                spriteBatch.Draw(TextureManager.Instance.GetParallax(_textureName), _position2, Color.White);

            spriteBatch.End();
        }
开发者ID:TheEternalCircle,项目名称:TheEternalCircleMasterSolution,代码行数:12,代码来源:HParallax.cs

示例4: Draw

 public void Draw(SpriteBatch spriteBatch, Camera2D camera, float pSpeed)
 {
     spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied, null, null, null, null, camera.GetParallaxMatrix(pSpeed));
     foreach (Partikel p in _partikelList)
     {
         _shader.CurrentTechnique.Passes[0].Apply();
         _shader.Parameters["_colorTex"].SetValue(p.DrawColor.ToVector4());
         p.Draw(spriteBatch);
     }
     spriteBatch.End();
 }
开发者ID:TheEternalCircle,项目名称:TheEternalCircleMasterSolution,代码行数:11,代码来源:RectanglePartikelEmitter.cs


注:本文中的Camera2D.GetParallaxMatrix方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。