Esempio n. 1
0
 public void AddCrate(Vector3 halfSize, 
     Vector3 position = new Vector3(), float mass = 5f)
 {
     Crate crate = new Crate(halfSize);
     crate.Mass = mass;
     crate.Position = position;
     crate.model = CrateModel;
     crate.Texture = CrateTexture;
     bodys.Add(crate);
     cg.AddBody(crate);
 }
Esempio n. 2
0
 public void AddCrate(Crate crate)
 {
     bodys.Add(crate);
     cg.AddBody(crate);
 }
Esempio n. 3
0
 public Crate CreateCrate(Vector3 position)
 {
     Crate crate = new Crate(new Vector3(0.5f, 0.5f, 0.5f));
     crate.Position = position;
     crate.Mass = 1f;
     crate.model = CrateModel;
     crate.Texture = CrateTexture;
     crate.SelectedTexture = SelectedCrateTexture;
     crate.SelectedTexture_Panel = SelectedCrateTexture2;
     AddCrate(crate);
     PhysiXEngine.Effect e = effects.Last<PhysiXEngine.Effect>();
     if (e as Gravity != null)
         ((Gravity)e).AddBody(crate);
     else
         throw new Exception();
     return crate;
 }
Esempio n. 4
0
        public void CreateRoom(float width, float length, float height)
        {
            Crate ground = new Crate(new Vector3(width, 4f, height));
            ground.Position = new Vector3(0f, -9f, 0f);
            ground.model = CrateModel;
            ground.Texture = Ground;
            ground.SelectedTexture = null;
            ground.InverseMass = 0;
            ground.Lock();
            AddToRoom(ground);

            Crate RightWall = new Crate(new Vector3(0.01f, length, height));
            RightWall.Position = new Vector3(width+0.01f, 5.01f, 0f);
            RightWall.model = CrateModel;
            RightWall.Texture = Wall;
            RightWall.SelectedTexture = null;
            RightWall.InverseMass = 0;
            RightWall.Lock();
            AddToRoom(RightWall);

            Crate FrontWall = new Crate(new Vector3(width, length, 0.01f));
            FrontWall.Position = new Vector3(0f, 5.01f, -(height + 0.01f));
            FrontWall.model = CrateModel;
            FrontWall.Texture = Game.Content.Load<Texture2D>(@"Textures\Wall");
            FrontWall.SelectedTexture = null;
            FrontWall.InverseMass = 0;
            FrontWall.Lock();
            AddToRoom(FrontWall);

            Crate LeftWall = new Crate(new Vector3(0.01f, length, height));
            LeftWall.Position = new Vector3(-(width+0.01f), 5.01f, 0f);
            LeftWall.model = CrateModel;
            LeftWall.Texture = Wall;
            LeftWall.SelectedTexture = null;
            LeftWall.InverseMass = 0;
            LeftWall.Lock();
            AddToRoom(LeftWall);

            Crate Slope = new Crate(new Vector3(width / 4, length - length / 4, 0.01f));
            Slope.Position = new Vector3(width - width / 4, length/4,  0f);
            Slope.AddScaledOrientation(new Vector3(-0.9f,0,0));
            Slope.model = CrateModel;
            Slope.Texture = Ground;
            Slope.SelectedTexture = null;
            Slope.InverseMass = 0;
            Slope.Lock();
            AddToRoom(Slope);

            Crate Roof = new Crate(new Vector3(width, 0.4f, height/4));
            Roof.Position = new Vector3(0, length / 2+length/4, -(height - height/4));
            Roof.model = CrateModel;
            Roof.Texture = Ground;
            Roof.SelectedTexture = null;
            Roof.InverseMass = 0;
            Roof.Lock();
            AddToRoom(Roof);

            Crate Stop = new Crate(new Vector3(width/4, 1f, 0.1f));
            Stop.Position = new Vector3(width - width / 4, -height/2 + 1, length);
            Stop.model = CrateModel;
            Stop.Texture = Ground;
            Stop.SelectedTexture = null;
            Stop.InverseMass = 0;
            Stop.Lock();
            AddToRoom(Stop);
        }
Esempio n. 5
0
 public void AddToRoom(Crate crate)
 {
     room.Add(crate);
     cg.AddBody(crate);
 }