예제 #1
0
        public void UpdateBorder(int SizeOfSystem)
        {
            sizeOfSystem = SizeOfSystem;
            //Console.WriteLine("Setting size of system to " + SizeOfSystem);
            if (Border.Body != null && _physicsManager.World.BodyList.Contains(Border.Body))
            {
                Debugging.DisposeStack.Push(this.ToString());
                Border.Body.Dispose();
            }
            borderList.Clear();

            Vertices verts = Boundaries.CreateConcaveSemiCircle(SizeOfSystem / 100f, SizeOfSystem / 100);

            foreach (Vector2 v in verts)
            {
                borderList.Add(v);
            }



            Border = new PlanetBorder();
            var tempbd = new CollisionDataObject(Border, BodyTypes.WallTile);

            Debugging.AddStack.Push(this.ToString());
            Border.Body                 = BodyFactory.CreateLoopShape(_physicsManager.World, verts, Vector2.Zero, tempbd);
            Border.Body.IsStatic        = true;
            Border.Body.UserData        = tempbd;
            Border.Body.SleepingAllowed = true;
            Border.Body.Friction        = 0f;
            Border.Body.Restitution     = 0.2f;
        }
예제 #2
0
        public void Reset(int SizeOfSystem)
        {
            Vertices verts = Boundaries.CreateConcaveSemiCircle(ConvertUnits.ToSimUnits(SizeOfSystem), SizeOfSystem / 100);

            foreach (Vector2 v in verts)
            {
                borderList.Add(v);
            }

            //var tempbd = new CollisionDataObject(BodyTypes.WallTile, 0);
            //Border = BodyFactory.CreateLoopShape(_physicsManager.World, verts, Vector2.Zero, tempbd);
            //Border.IsStatic = true;
            //Border.UserData = tempbd;
            //Border.SleepingAllowed = true;
            //Border.Friction = 20000f;
            //Border.Restitution = 0.2f;

            //if (Border.FixtureList == null)
            //    Console.WriteLine("Why is this happening?");
        }