Example #1
0
 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);
 }
Example #2
0
        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();
        }
Example #3
0
 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();
         }
 }
Example #4
0
        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();
                }
        }
Example #5
0
 public virtual void Draw(Camera camera)
 {
 }
Example #6
0
        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);
            }
        }
Example #7
0
 void Start()
 {
     pauseUICamera = GameObject.FindGameObjectWithTag("Pause UI Camera").GetRequiredComponent <Camera>();
     pauseButton   = GameObject.FindGameObjectWithTag("Pause button").GetRequiredComponent <Button>();
 }
Example #8
0
 public ModelManager(Game game, Camera camera)
     : base(game)
 {
     _camera = camera;
 }