コード例 #1
0
        public override void InitializeComponents()
        {
            float angle = 0.6f;
            SolidComponent sc = new SolidComponent(game, Game1.models["rail"], Color.Silver);
            sc.SetWorld(.5f, new Vector3(6, 19.5f, 12.5f), Quaternion.CreateFromRotationMatrix(Matrix.CreateRotationY(MathHelper.ToRadians(87f)) * Matrix.CreateRotationZ(MathHelper.ToRadians(-angle))));
            Add(sc);

            sc = new SolidComponent(game, Game1.models["rail"], Color.Silver);
            sc.SetWorld(.5f, new Vector3(6, 18.7f, 12.5f), Quaternion.CreateFromRotationMatrix(Matrix.CreateRotationY(MathHelper.ToRadians(87f))*Matrix.CreateRotationZ(MathHelper.ToRadians(angle))));
            Add(sc);

            angle = 0.6f;
            sc = new SolidComponent(game, Game1.models["rail"], Color.Silver);
            sc.SetWorld(.5f, new Vector3(0, 19.5f, 10.5f), Quaternion.CreateFromRotationMatrix(Matrix.CreateRotationY(MathHelper.ToRadians(87f)) * Matrix.CreateRotationZ(MathHelper.ToRadians(-angle))));
            Add(sc);

            sc = new SolidComponent(game, Game1.models["rail"], Color.Silver);
            sc.SetWorld(.5f, new Vector3(0, 18.7f, 10.5f), Quaternion.CreateFromRotationMatrix(Matrix.CreateRotationY(MathHelper.ToRadians(87f)) * Matrix.CreateRotationZ(MathHelper.ToRadians(angle))));
            Add(sc);

            angle = 0.0f;
            sc = new SolidComponent(game, Game1.models["rail"], Color.Silver);
            sc.SetWorld(.5f, new Vector3(-6, 19.4f, 8.5f), Quaternion.CreateFromRotationMatrix(Matrix.CreateRotationY(MathHelper.ToRadians(80f)) * Matrix.CreateRotationZ(MathHelper.ToRadians(-angle))));
            Add(sc);

            sc = new SolidComponent(game, Game1.models["rail"], Color.Silver);
            sc.SetWorld(.5f, new Vector3(-6, 18.8f, 8.5f), Quaternion.CreateFromRotationMatrix(Matrix.CreateRotationY(MathHelper.ToRadians(80f)) * Matrix.CreateRotationZ(MathHelper.ToRadians(angle))));
            Add(sc);
        }
コード例 #2
0
        public override void InitializeComponents()
        {
            SolidComponent sc = new SolidComponent(game, Game1.models["slab"], Color.Green);
            sc.SetWorld(0.5f, new Vector3(14, 19, 17), Quaternion.CreateFromAxisAngle(new Vector3(0,1,0), -MathHelper.ToRadians(25f)));
            Add(sc);

            sc = new SolidComponent(game, Game1.models["slab"], Color.Green);
            sc.SetWorld(0.5f, new Vector3(12, 19, 15), Quaternion.CreateFromAxisAngle(Vector3.UnitY, MathHelper.ToRadians(35f)));
            Add(sc);

            sc = new SolidComponent(game, Game1.models["slab"], Color.Green);
            sc.SetWorld(0.5f, new Vector3(14, 19, 14), Quaternion.CreateFromAxisAngle(Vector3.UnitY, -MathHelper.ToRadians(35f)));
            Add(sc);

            //sc = new SolidComponent(game, game.Content.Load<Model>("slab"), Color.Black.ToVector3());
            //sc.SetWorld(1, new Vector3(10, 10, 7), Quaternion.CreateFromAxisAngle(Vector3.UnitY, -MathHelper.ToRadians(25f)));
            //Add(sc);
        }
コード例 #3
0
        public override void InitializeComponents()
        {
            SolidComponent s = new SolidComponent(this.game, Game1.models["small_cube"], Color.Violet);
            s.SetWorld(3f, new Vector3(5, 5.5f, 1), Quaternion.Identity);
            s.Freeze();
            this.Add(s);

            s = new SolidComponent(this.game, Game1.models["small_cube"], Color.Violet);
            s.SetWorld(3f, new Vector3(5, 7.4f, 1), Quaternion.Identity);
            s.Freeze();
            this.Add(s);

            TrackOnCollision t = new TrackOnCollision(this.game, Game1.models["obelisk"], Color.Red);
            t.SetWorld(0.75f, new Vector3(5,5.69f,3.15f),
                Quaternion.CreateFromRotationMatrix(Matrix.CreateRotationY(MathHelper.ToRadians(-65f)) * Matrix.CreateRotationZ(MathHelper.ToRadians(90f))));
            this.Add(t);

            t = new TrackOnCollision(this.game, Game1.models["obelisk"], Color.Red);
            t.SetWorld(0.75f, new Vector3(5, 7.12f, 3.15f),
                Quaternion.CreateFromRotationMatrix(Matrix.CreateRotationY(MathHelper.ToRadians(65f)) * Matrix.CreateRotationZ(MathHelper.ToRadians(90f))));
            this.Add(t);

            for (int i = 0; i < 3; i++)
            {
                t = new TrackOnCollision(this.game, Game1.models["obelisk"], Color.Red);
                t.SetWorld(0.75f, new Vector3(5,4.1f - i * 2f,1.5f),
                    Quaternion.CreateFromRotationMatrix(Matrix.CreateRotationY(MathHelper.ToRadians(90f)) * Matrix.CreateRotationZ(MathHelper.ToRadians(90f))));
                this.Add(t);
            }

            for (int i = 0; i < 3; i++)
            {
                t = new TrackOnCollision(this.game, Game1.models["obelisk"], Color.Red);
                t.SetWorld(0.75f, new Vector3(5, 8.5f + i*2f, 1.5f),
                    Quaternion.CreateFromRotationMatrix(Matrix.CreateRotationY(MathHelper.ToRadians(90f)) * Matrix.CreateRotationZ(MathHelper.ToRadians(90f))));
                this.Add(t);
            }

            //    s = new SolidComponent(this.game, Game1.models["sphere"], Color.Brown);
            //s.SetWorld(1f, new Vector3(5, 6.2f, 20), Quaternion.Identity);
            //this.Add(s);
        }