コード例 #1
0
ファイル: PlayerSerpent.cs プロジェクト: danbystrom/Serpent
 public PlayerSerpent(
     Game game,
     PlayingField pf,
     ModelWrapper modelHead,
     ModelWrapper modelSegment)
     : base(game, pf, modelHead, modelSegment, new Whereabouts(0, Point.Zero, Direction.East))
 {
     _camera = new Camera(
         game.Window.ClientBounds,
         new Vector3(0, 20, 2),
         Vector3.Zero,
         CameraBehavior.FollowSerpent);
 }
コード例 #2
0
ファイル: EnemySerpent.cs プロジェクト: danbystrom/Serpent
        public EnemySerpent(
            PlayingField pf,
            Model modelHead,
            Model modelSegment,
            Camera camera,
            Whereabouts whereabouts,
            int x)
            : base(pf, modelHead, modelSegment, whereabouts)
        {
            _whereabouts = whereabouts;
             _rnd.NextBytes(new byte[x]);
            _camera = camera;

            addTail();
            addTail();
        }
コード例 #3
0
ファイル: ModelWrapper.cs プロジェクト: danbystrom/Serpent
 public void Draw(
     Camera camera,
     Matrix world,
     Vector3 tintColor,
     float tintFactor,
     float alpha )
 {
     foreach (var mesh in _model.Meshes)
         {
             foreach (StockEffects.BasicEffect e in mesh.Effects)
             {
                 e.DiffuseColor = Vector3.Lerp(e.OriginalDiffuseColor, tintColor, tintFactor);
                 e.Alpha = alpha;
                 e.View = camera.View;
                 e.Projection = camera.Projection;
                 e.World = _bones[mesh.ParentBone.Index]*world;
             }
             mesh.Draw();
         }
 }
コード例 #4
0
ファイル: TreesModel.cs プロジェクト: danbystrom/Serpent
        public override void Draw(Camera camera)
        {
            var transforms = new Matrix[model.Bones.Count];
            model.CopyAbsoluteBoneTransformsTo(transforms);

            for (var i = 0; i < 20; i+=4 )
                foreach (var mesh in model.Meshes)
                {
                    foreach (BasicEffect be in mesh.Effects)
                    {
                        be.EnableDefaultLighting();
                        be.Projection = camera.Projection;
                        be.View = camera.View;
                        be.World = GetWorld() *
                            mesh.ParentBone.Transform *
                            //Matrix.CreateRotationZ(MathHelper.Pi) *
                            Matrix.CreateScale(1.15f) *
                            Matrix.CreateTranslation(i, 0, 21);
                    }
                    mesh.Draw();
                }
        }
コード例 #5
0
ファイル: BasicModel.cs プロジェクト: danbystrom/Serpent
 public virtual void Draw(Camera camera)
 {
 }
コード例 #6
0
ファイル: PlayingField.cs プロジェクト: danbystrom/Serpent
        public void Draw( Camera camera )
        {
            //Set object and camera info
            _effect.View = camera.View;
            _effect.Projection = camera.Projection;
            _effect.GraphicsDevice.SamplerStates[0] = new SamplerState() {Filter = TextureFilter.Linear};

            _effect.World = Matrix.CreateTranslation( -0.5f, 0, -0.5f );
            _effect.Texture = _texture;
            _effect.TextureEnabled = true;
            _effect.VertexColorEnabled = false;
            foreach (var pass in _effect.CurrentTechnique.Passes)
            {
                pass.Apply();
                VertexBuffer.GraphicsDevice.SetVertexBuffer(VertexBuffer);
                VertexBuffer.GraphicsDevice.DrawPrimitives(
                    PrimitiveType.TriangleList,
                    0,
                    VertexBuffer.VertexCount);
            }

            _effect.TextureEnabled = false;
            _effect.VertexColorEnabled = true;
            foreach (var pass in _effect.CurrentTechnique.Passes)
            {
                pass.Apply();
                VertexBufferShadow.GraphicsDevice.SetVertexBuffer(VertexBufferShadow);
                VertexBufferShadow.GraphicsDevice.DrawPrimitives(
                    PrimitiveType.TriangleList,
                    0,
                    VertexBufferShadow.VertexCount);
            }
        }
コード例 #7
0
 void Start()
 {
     pauseUICamera = GameObject.FindGameObjectWithTag("Pause UI Camera").GetRequiredComponent <Camera>();
     pauseButton   = GameObject.FindGameObjectWithTag("Pause button").GetRequiredComponent <Button>();
 }
コード例 #8
0
ファイル: ModelManager.cs プロジェクト: danbystrom/Serpent
 public ModelManager(Game game, Camera camera)
     : base(game)
 {
     _camera = camera;
 }