Exemplo n.º 1
0
        private DemoScene()
        {
            // set up camera
            Camera = new Camera
            {
                //Zoom = 2,
                Origin   = new Vector2(320, 180),
                Position = new Vector2(200, 400)
            };

            map    = new DemoMap();
            player = new Player(Camera);
            TestEnemy enemy = new TestEnemy(new Vector2(200, 600), player);

            enemy2 = new WalkingEnemy(new Vector2(295, 365), player);
            //enemy2 = new WalkingEnemy(new Vector2(250, 400), player);
            Item item = new Item(player, new Vector2(100, 500));

            children.Add(map);
            children.Add(player);
            //children.Add(enemy);
            children.Add(enemy2);
            children.Add(item);

            physical = new PhysicsGroup(PhysicsGroupType.Physical);
            physical.Add(map);
            physical.Add(player);
            //physical.Add(enemy);
            physical.Add(enemy2);

            writer = new FragmentWriter("Fonts/TooMuchInk", new Rectangle(100, 450, 200, 200), Color.White);
            writer.SetText(Fragment.Parse(example));
        }
Exemplo n.º 2
0
        //  surface_property_override(surface_properties) : "Surface Property Override" : "" : "Overrides the default surface property."

        public override void Spawn()
        {
            base.Spawn();

            EnableDrawing = true;

            SetupPhysicsFromModel(PhysicsMotionType.Static);

            // Custom surface property with 0 friction, 0 elasticity.
            PhysicsGroup.SetSurface("minigolf.side");

            Transmit = TransmitType.Always;
        }
Exemplo n.º 3
0
        public void ApplyForceToBone(Vector3 force, int forceBone)
        {
            PhysicsGroup.AddVelocity(force);

            if (forceBone >= 0)
            {
                var body = GetBonePhysicsBody(forceBone);

                if (body != null)
                {
                    body.ApplyForce(force * 1000);
                }
                else
                {
                    PhysicsGroup.AddVelocity(force);
                }
            }
        }
Exemplo n.º 4
0
        public void TriArrayErrorCase()
        {
            PhysicsGroup physicsGroup = new PhysicsGroup(PhysicsGroupType.Physical);

            DemoMap demoMap = new DemoMap();
            Player  player  = new Player(new RBGNature.Camera());

            player.collision = new Circle()
            {
                Radius   = 10,
                Mass     = 1,
                Position = new Vector2(170.716476f, 303.425659f),
                Velocity = new Vector2(-0.17978698f, 0.0744702f)
            };

            physicsGroup.Add(demoMap);
            physicsGroup.Add(player);

            physicsGroup.Collide(16.6488f);

            player.Update(new GameTime());

            Assert.IsTrue(player.collision.Position.X + player.collision.Position.Y > 460 + Math.Sqrt(2) * 10);
        }
Exemplo n.º 5
0
 public void Remove()
 {
     PhysicsGroup?.Wake();
     Delete();
 }