コード例 #1
0
        protected AntiGravPropulsor CreateAntiGravPropulsor(GraphicsDevice g, Matrix Projection, float Length, Vector3 Position)
        {
            AntiGravPropulsor NewAntiGravPropulsor = new AntiGravPropulsor(g, Projection, Length);

            NewAntiGravPropulsor.Teleport(Position);

            return(NewAntiGravPropulsor);
        }
コード例 #2
0
        public Vehicule2D(List <AITunnel> ListAITunnel, List <Object3D> ListCollisionBox, GraphicsDevice g, Vector3 Position)
            : base(g, Matrix.Identity, ListAITunnel, ListCollisionBox)
        {
            DicVehiculeSpritePerAngle = new Dictionary <int, Texture2D>();

            float aspectRatio = g.Viewport.Width / (float)g.Viewport.Height;

            Projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver4,
                                                             aspectRatio,
                                                             1, 10000);
            TeleportRelative(Position);
            ArrayAntiGravPropulsor              = new AntiGravPropulsor[1];
            ArrayAntiGravPropulsor[0]           = CreateAntiGravPropulsor(g, Projection, 1f, Position);
            ArrayAntiGravPropulsor[0].Position += new Vector3(0f, 2f, 0f);
        }
コード例 #3
0
        public override void Draw(CustomSpriteBatch g, Matrix View)
        {
            effect.View = View;

            effect.World = Rotation
                           * Matrix.CreateTranslation(Position);

            effect.CurrentTechnique.Passes[0].Apply();
            g.GraphicsDevice.DrawUserPrimitives(PrimitiveType.TriangleList, vertexes, 0, 12);

            foreach (Object3D AntiGravPropulsor in ArrayAntiGravPropulsor)
            {
                AntiGravPropulsor.Draw(g, View);
            }
        }
コード例 #4
0
        public override void Draw(CustomSpriteBatch g, Matrix View)
        {
            Matrix World = Matrix.CreateTranslation(0f, 0f, 0f);

            VehiculeDrawablePart.ArrayParticles[0].Position     = Position;
            VehiculeDrawablePart.ArrayParticles[0 + 1].Position = Position;
            VehiculeDrawablePart.ArrayParticles[0 + 2].Position = Position;
            VehiculeDrawablePart.ArrayParticles[0 + 3].Position = Position;

            VehiculeDrawablePart.MoveParticle(0, Vector3.Zero);
            VehiculeDrawablePart.SetViewProjection(World * View, Projection);
            VehiculeDrawablePart.Draw(g.GraphicsDevice);

            foreach (Object3D AntiGravPropulsor in ArrayAntiGravPropulsor)
            {
                AntiGravPropulsor.Draw(g, View);
            }
        }
コード例 #5
0
        public void Update(GameTime gameTime)
        {
            ListActionMenuChoice.Last().Update(gameTime);
            Speed += RacingMap.Gravity * (float)gameTime.ElapsedGameTime.TotalSeconds;
            ApplyFriction(gameTime.ElapsedGameTime.TotalSeconds);

            foreach (AntiGravPropulsor AntiGravPropulsor in ArrayAntiGravPropulsor)
            {
                Speed += AntiGravPropulsor.UpdatePropulsorTrust(gameTime, Speed, ListCollisionBox);
            }

            UpdatePosition(gameTime);

            foreach (AntiGravPropulsor AntiGravPropulsor in ArrayAntiGravPropulsor)
            {
                SnapPropulsorToVehicule(AntiGravPropulsor, new Vector3(0f, 2f, 0f));
            }

            DoUpdate(gameTime);
        }
コード例 #6
0
        public Vehicule3D(List <AITunnel> ListAITunnel, List <Object3D> ListCollisionBox, GraphicsDevice g, Vector3 Position)
            : base(g, Matrix.Identity, ListAITunnel, ListCollisionBox)
        {
            TeleportRelative(Position);

            effect = new BasicEffect(g);
            effect.AmbientLightColor              = new Vector3(1, 0, 0);
            effect.DirectionalLight0.Enabled      = true;
            effect.DirectionalLight0.DiffuseColor = Vector3.One;
            effect.DirectionalLight0.Direction    = Vector3.Normalize(Vector3.One);
            effect.LightingEnabled = true;

            float  aspectRatio = g.Viewport.Width / (float)g.Viewport.Height;
            Matrix Projection  = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver4,
                                                                     aspectRatio,
                                                                     1, 10000);

            effect.Projection = Projection;

            vertexes = RacingMap.CreateCube();
            ArrayAntiGravPropulsor              = new AntiGravPropulsor[1];
            ArrayAntiGravPropulsor[0]           = CreateAntiGravPropulsor(g, Projection, 1f, Position);
            ArrayAntiGravPropulsor[0].Position += new Vector3(0f, 2f, 0f);
        }