Inheritance: IUpdateable, IDrawable, INode
Esempio n. 1
0
        public SeeSaw(Project2Game game, LevelPiece levelPiece, Vector3 offset) : base(game, levelPiece, offset) {
            
            var baseHeight = 2;

            Box seeSawbase = new Box(
                    game,
                    game.models["box"],
                    this.originPosition + new Vector3(0f, 0.5f * baseHeight, 0f),
                    new Vector3(30f, 3f, 1.5f)
                );
            seeSawbase.PhysicsDescription.IsStatic = true;
            Box seeSawPlatform= new Box(
                    game,
                    game.models["box"],
                    this.originPosition + new Vector3(0f, 2f * baseHeight, 0f),
                    new Vector3(50f, 1f, 40f)
                );
            seeSawPlatform.PhysicsDescription.IsStatic = false;
            seeSawPlatform.PhysicsDescription.Mass = 50f;
            //var constraint = new Jitter.Dynamics.Joints.HingeJoint(game.physics.World, seeSawbase.physicsDescription.RigidBody, seeSawPlatform.physicsDescription.RigidBody, PhysicsSystem.toJVector(this.originPosition + new Vector3(0f, baseHeight, 0f)), Jitter.LinearMath.JVector.Right);
            //constraint.PointOnPointConstraint1.Softness = 0.001f;
            var constraint = new Jitter.Dynamics.Constraints.PointOnPoint(seeSawbase.PhysicsDescription, seeSawPlatform.PhysicsDescription, PhysicsSystem.toJVector(originPosition + new Vector3(0, 0.5f * baseHeight, 0)));
            constraint.BiasFactor = 100f;
            //constraint.Softness = 0.001f;
            //game.physics.World.AddConstraint(constraint);
            this.AddChild(seeSawPlatform);
            this.AddChild(seeSawbase);

        }
Esempio n. 2
0
 public BrickWall(Project2Game game, LevelPiece levelPiece, Vector3 offset, int height, int width, bool interleaved) :
     base(game, levelPiece, offset)
 {
     for (int i = 0; i < width; i++)
     {
         for (int j = 0; j < height; j++)
         {
             float sizeScaler = 4f;
             Vector3 brickPosition = this.originPosition + offset + new Vector3(2f * i, 1f * j, 0f) * (sizeScaler);
             brickPosition.Y += sizeScaler/2f; //push all bricks off the ground
             if (interleaved) {
                 if (j % 2 == 1) {
                     brickPosition.X += sizeScaler;
                 }
             }
             Brick newBrick = new Brick(
                 game,
                 game.models["box"],
                 brickPosition,
                 new Vector3(2f, 1f, 1f) * sizeScaler,
                 false
             );
             this.AddChild(newBrick);
         }
     }
 }
Esempio n. 3
0
 public EndGoal(Project2Game game, LevelPiece levelPiece, Vector3 offset) : base(game, levelPiece, offset)
 {
     // place obelisk
     var scale = new Vector3(6, 6, 6);
     obelisk = new Obelisk(game, offset + new Vector3(0, scale.Y * 0.5f, 0), scale);
     obelisk.PhysicsDescription.IsStatic = true;
     this.AddChild(obelisk);
 }
 public PhysicsPuzzle(Game game, LevelPiece levelPiece, Vector3 offset ) {
     this.game = game;
     Children = new List<INode>();
     this.levelPiece = levelPiece;
     this.originPosition = levelPiece.OriginPosition += offset;
 }