示例#1
0
 public Construct(ScrapGame game)
 {
     this.game = game;
     joints = new List<Joint>();
     entities = new List<Segment>();
     buildElements = new Dictionary<Point,ConstructElement>();
     game.constructList.Add(this);
 }
示例#2
0
 public Construct(ScrapGame game)
 {
     this.game     = game;
     joints        = new List <Joint>();
     entities      = new List <Segment>();
     buildElements = new Dictionary <Point, ConstructElement>();
     game.constructList.Add(this);
 }
示例#3
0
 public ConstructElement(ScrapGame game, Segment entity, Construct construct, Point offSet, Joint rootJoint)
 {
     branchJoints = new List<Joint>();
     this.rootJoint = rootJoint;
     this.segment = entity;
     this.game = game;
     this.construct = construct;
     this.offSet = offSet;
 }
示例#4
0
文件: Nozzle.cs 项目: MrMallet/Scrap
        public Nozzle(ScrapGame game, Vector2 position)
            : base(game)
        {
            texture = game.Content.Load<Texture2D>("Crate");

            body = BodyFactory.CreateRoundedRectangle(((ScrapGame)game).world, 1f, 1f, .2f, .2f, 5, 1f, this);
            body.BodyType = BodyType.Dynamic;
            body.Position = position;
        }
示例#5
0
        public Nozzle(ScrapGame game, Vector2 position)
            : base(game)
        {
            texture = game.Content.Load <Texture2D>("Crate");

            body          = BodyFactory.CreateRoundedRectangle(((ScrapGame)game).world, 1f, 1f, .2f, .2f, 5, 1f, this);
            body.BodyType = BodyType.Dynamic;
            body.Position = position;
        }
示例#6
0
 public ConstructElement(ScrapGame game, Segment entity, Construct construct, Point offSet, Joint rootJoint)
 {
     branchJoints   = new List <Joint>();
     this.rootJoint = rootJoint;
     this.segment   = entity;
     this.game      = game;
     this.construct = construct;
     this.offSet    = offSet;
 }
示例#7
0
文件: Rocket.cs 项目: MrMallet/Scrap
 public Rocket(ScrapGame game, Vector2 position)
     : base(game)
 {
     texture = game.Content.Load<Texture2D>("Rocket");
     body = BodyFactory.CreateRoundedRectangle(((ScrapGame)game).world, 1f, 1f, .2f, .2f, 5, 1f, this);
     body.BodyType = BodyType.Dynamic;
     body.Position = position;
     body.Restitution = .1f;
     body.Friction = .9f;
 }
示例#8
0
 public Rocket(ScrapGame game, Vector2 position)
     : base(game)
 {
     texture          = game.Content.Load <Texture2D>("Rocket");
     body             = BodyFactory.CreateRoundedRectangle(((ScrapGame)game).world, 1f, 1f, .2f, .2f, 5, 1f, this);
     body.BodyType    = BodyType.Dynamic;
     body.Position    = position;
     body.Restitution = .1f;
     body.Friction    = .9f;
 }
示例#9
0
文件: Wheel.cs 项目: MrMallet/Scrap
        public Wheel(ScrapGame game, Vector2 position)
            : base(game)
        {
            texture = game.Content.Load<Texture2D>("wheel");

            wheel = BodyFactory.CreateCircle(game.world, .49f, 1f, this);
            wheel.Restitution = .5f;
            wheel.BodyType = BodyType.Dynamic;
            wheel.Position = position;
            wheel.Friction = .9f;
            //wheel.CollisionCategories = new Category();

            body = BodyFactory.CreateRectangle(game.world, .5f, .5f, .5f, this);
            body.Position = position;
            body.BodyType = BodyType.Dynamic;
            body.Restitution = .5f;
            body.Friction = .9f;

            bodyJoint = JointFactory.CreateRevoluteJoint(game.world, body, wheel, new Vector2(0, 0), new Vector2(0, 0));
        }
示例#10
0
        public DriveWheel(ScrapGame game, Vector2 position)
            : base(game)
        {
            texture = game.Content.Load<Texture2D>("wheel");

            wheel = BodyFactory.CreateCircle(game.world, .49f, 2f,this);
            wheel.Restitution = 1f;
            wheel.BodyType = BodyType.Dynamic;
            wheel.Position = position;
            wheel.Friction = 2f;

            wheel.UserData = this;

            body = BodyFactory.CreateRectangle(game.world, .1f, .1f, 2f);
            body.Position = position;
            body.BodyType = BodyType.Dynamic;

            //body.IgnoreCCD = true;

            wheelHubJoint = JointFactory.CreateRevoluteJoint(game.world, body, wheel, new Vector2(0, 0));
        }
示例#11
0
文件: Wheel.cs 项目: MrMallet/Scrap
        public Wheel(ScrapGame game, Vector2 position)
            : base(game)
        {
            texture = game.Content.Load <Texture2D>("wheel");

            wheel             = BodyFactory.CreateCircle(game.world, .49f, 1f, this);
            wheel.Restitution = .5f;
            wheel.BodyType    = BodyType.Dynamic;
            wheel.Position    = position;
            wheel.Friction    = .9f;
            //wheel.CollisionCategories = new Category();


            body             = BodyFactory.CreateRectangle(game.world, .5f, .5f, .5f, this);
            body.Position    = position;
            body.BodyType    = BodyType.Dynamic;
            body.Restitution = .5f;
            body.Friction    = .9f;


            bodyJoint = JointFactory.CreateRevoluteJoint(game.world, body, wheel, new Vector2(0, 0), new Vector2(0, 0));
        }
示例#12
0
        public ScrapBadger(ScrapGame game, Vector2 pos) : base(game)
        {
            torsoBack   = new Crate(game, pos + new Vector2(-1, 0));
            torsoMiddle = new Crate(game, pos);
            torsoFront  = new Crate(game, pos + new Vector2(1, 0));
            backWheel   = new Wheel(game, pos + new Vector2(-1, 1));
            frontWheel  = new Wheel(game, pos + new Vector2(1, 1));
            rocket1     = new Rocket(game, pos + new Vector2(0, -1));

            KeyObject = torsoMiddle;
            JoinEntities(torsoMiddle, torsoFront, Direction.Right);
            JoinEntities(torsoMiddle, rocket1, Direction.Up);
            JoinEntities(torsoMiddle, torsoBack, Direction.Left);

            JoinEntities(torsoBack, backWheel, Direction.Down);
            //backWheel.body.UserData = this;
            //frontWheel.body.UserData = this;
            JoinEntities(torsoFront, frontWheel, Direction.Down);


            game.camera.Follow(torsoMiddle, game.camera.Magnification);
        }
示例#13
0
        public DriveWheel(ScrapGame game, Vector2 position)
            : base(game)
        {
            texture = game.Content.Load <Texture2D>("wheel");

            wheel             = BodyFactory.CreateCircle(game.world, .49f, 2f, this);
            wheel.Restitution = 1f;
            wheel.BodyType    = BodyType.Dynamic;
            wheel.Position    = position;
            wheel.Friction    = 2f;

            wheel.UserData = this;

            body          = BodyFactory.CreateRectangle(game.world, .1f, .1f, 2f);
            body.Position = position;
            body.BodyType = BodyType.Dynamic;


            //body.IgnoreCCD = true;

            wheelHubJoint = JointFactory.CreateRevoluteJoint(game.world, body, wheel, new Vector2(0, 0));
        }
示例#14
0
        public ScrapBadger(ScrapGame game, Vector2 pos)
            : base(game)
        {
            torsoBack = new Crate(game, pos + new Vector2(-1,0));
            torsoMiddle = new Crate(game, pos);
            torsoFront = new Crate(game, pos + new Vector2(1, 0));
            backWheel = new Wheel(game, pos + new Vector2(-1, 1));
            frontWheel = new Wheel(game, pos + new Vector2(1, 1));
            rocket1 = new Rocket(game, pos + new Vector2(0, -1));

            KeyObject = torsoMiddle;
            JoinEntities(torsoMiddle, torsoFront, Direction.Right);
            JoinEntities(torsoMiddle, rocket1, Direction.Up);
            JoinEntities(torsoMiddle, torsoBack, Direction.Left);

            JoinEntities(torsoBack, backWheel, Direction.Down);
            //backWheel.body.UserData = this;
            //frontWheel.body.UserData = this;
            JoinEntities(torsoFront, frontWheel, Direction.Down);

            game.camera.Follow(torsoMiddle, game.camera.Magnification);
        }
示例#15
0
 public Nozzle(ScrapGame game)
     : base(game)
 {
     texture = game.Content.Load <Texture2D>("Crate");
 }
示例#16
0
文件: Crate.cs 项目: MrMallet/Scrap
 public Crate(ScrapGame game)
     : base(game)
 {
     texture = game.Content.Load<Texture2D>("Crate");
 }
示例#17
0
文件: Segment.cs 项目: MrMallet/Scrap
 public Segment(ScrapGame game)
 {
     this.game = game;
     game.entityList.Add(this);
 }
示例#18
0
文件: Terrain.cs 项目: MrMallet/Scrap
        Vector2 WorldLimits = new Vector2(50000, 400);//world limits should be set by the terrain max.

        public Terrain(ScrapGame game)
        {
            this.game = game;
        }
示例#19
0
文件: Rocket.cs 项目: MrMallet/Scrap
 public Rocket(ScrapGame game)
     : base(game)
 {
     texture = game.Content.Load<Texture2D>("Rocket");
 }
示例#20
0
文件: Segment.cs 项目: MrMallet/Scrap
 public Segment(ScrapGame game)
 {
     this.game = game;
     game.entityList.Add(this);
 }
示例#21
0
 public Rocket(ScrapGame game)
     : base(game)
 {
     texture = game.Content.Load <Texture2D>("Rocket");
 }