public void Render(Position pos, Dungeon map) { GameObject wall; // floor if (!map.HasContent(pos + new Position (0, -1, 0))) { wall = GameObject.CreatePrimitive (PrimitiveType.Quad); wall.renderer.material = floorMaterial; map.AddChild(wall); wall.transform.Rotate(90,0,0); wall.transform.position = pos.Vector3 + new Vector3 (0, -0.5f, 0); } // ceiling if (!map.HasContent(pos + new Position (0, 1, 0))) { wall = GameObject.CreatePrimitive (PrimitiveType.Quad); wall.renderer.material = ceilingMaterial; map.AddChild(wall); wall.transform.Rotate(-90,0,0); wall.transform.position = pos.Vector3 + new Vector3 (0, 0.5f, 0); } // walls if (!map.HasContent(pos + new Position (-1, 0, 0))) { wall = GameObject.CreatePrimitive (PrimitiveType.Quad); wall.renderer.material = wallMaterial; map.AddChild(wall); wall.transform.Rotate(0,-90,0); wall.transform.position = pos.Vector3 + new Vector3 (-0.5f, 0, 0); } if (!map.HasContent(pos + new Position (1, 0, 0))) { wall = GameObject.CreatePrimitive (PrimitiveType.Quad); wall.renderer.material = wallMaterial; map.AddChild(wall); wall.transform.Rotate(0,90,0); wall.transform.position = pos.Vector3 + new Vector3 (0.5f, 0, 0); } if (!map.HasContent(pos + new Position (0, 0, -1))) { wall = GameObject.CreatePrimitive (PrimitiveType.Quad); wall.renderer.material = wallMaterial; map.AddChild(wall); wall.transform.Rotate(0,180,0); wall.transform.position = pos.Vector3 + new Vector3 (0, 0, -0.5f); } if (!map.HasContent(pos + new Position (0, 0, 1))) { wall = GameObject.CreatePrimitive (PrimitiveType.Quad); wall.renderer.material = wallMaterial; map.AddChild(wall); wall.transform.Rotate(0,0,0); wall.transform.position = pos.Vector3 + new Vector3 (0, 0, 0.5f); } }
public void Render(Position pos, Dungeon map) { var end = (GameObject)Object.Instantiate(endTrigger); end.transform.position = pos.Vector3; map.AddChild (end); }