public bool AddNewObject(Gobject gob) { lock (newObjects) { if (gameObjects.ContainsKey(gob.ID) || newObjects.ContainsKey(gob.ID)) return false; newObjects.Add(gob.ID, gob); } return true; }
public bool AddNewObject(Gobject gob) { lock (newObjects) { if (gameObjects.ContainsKey(gob.ID) || newObjects.ContainsKey(gob.ID)) { return(false); } newObjects.Add(gob.ID, gob); } return(true); }
public Gobject GetSphere(Vector3 pos, float radius, Model model, bool moveable) { Sphere spherePrimitive = new Sphere(pos, radius); Gobject sphere = new Gobject( pos, Vector3.One * radius, spherePrimitive, model, moveable, "sphere"); //newObjects.Add(sphere.ID, sphere); return(sphere); }
private Gobject GetBox(Vector3 pos, Vector3 size, Matrix orient, Model model, bool moveable) { // position of box was upper leftmost corner // body has world position // skin is relative to the body Box boxPrimitive = new Box(-.5f * size, orient, size); // relative to the body, the position is the top left-ish corner instead of the center, so subtract from the center, half of all sides to get that point. Gobject box = new Gobject( pos, size / 2, boxPrimitive, model, moveable, "cube" ); //newObjects.Add(box.ID, box); return(box); }
private Gobject GetBox(Vector3 pos, Vector3 size, Matrix orient, Model model, bool moveable) { // position of box was upper leftmost corner // body has world position // skin is relative to the body Box boxPrimitive = new Box(-.5f * size, orient, size); // relative to the body, the position is the top left-ish corner instead of the center, so subtract from the center, half of all sides to get that point. Gobject box = new Gobject( pos, size / 2, boxPrimitive, model, moveable, "cube" ); //newObjects.Add(box.ID, box); return box; }
public Gobject GetSphere(Vector3 pos, float radius, Model model, bool moveable) { Sphere spherePrimitive = new Sphere(pos, radius); Gobject sphere = new Gobject( pos, Vector3.One * radius, spherePrimitive, model, moveable, "sphere"); //newObjects.Add(sphere.ID, sphere); return sphere; }