public Enemy() { tieFighter = new Blender(); tieFighter.ReadBinaryFile("test_with_normals.bin"); tieFighter.Scale(new Vector3(0.02f, 0.02f, 0.02f)); float xOffset = random.Next(20)/10f - 1f; float yOffset = random.Next(20)/10f - 1f; float zOffset = random.Next(10)/10f - 0.5f; int colorSelection = random.Next(3); switch (colorSelection) { case 0: tieFighter.SetColor(Colors.RED_COLOR); break; case 1: tieFighter.SetColor(Colors.GREEN_COLOR); break; case 2: tieFighter.SetColor(Colors.BLUE_COLOR); break; default: tieFighter.SetColor(Colors.YELLOW_COLOR); break; } xOffset = xOffset * scale; yOffset = yOffset * scale; zOffset = zOffset * scale; tieFighter.SetOffset(new Vector3(xOffset, yOffset, zOffset)); }
public override String keyboard(Keys keyCode, int x, int y) { StringBuilder result = new StringBuilder(); switch (keyCode) { case Keys.D1: Shape.RotateWorld(Vector3.UnitX, 5f); break; case Keys.D2: Shape.RotateWorld(Vector3.UnitX, -5f); break; case Keys.D3: Shape.RotateWorld(Vector3.UnitY, 5f); break; case Keys.D4: Shape.RotateWorld(Vector3.UnitY, -5f); break; case Keys.D5: Shape.RotateWorld(Vector3.UnitZ, 5f); break; case Keys.D6: Shape.RotateWorld(Vector3.UnitZ, -5f); break; case Keys.I: result.AppendLine("Found " + blender.ObjectCount().ToString() + " objects in Blender file."); result.AppendLine("Found " + blender2.ObjectCount().ToString() + " objects in Blender 2 file."); result.AppendLine("Found " + blender3.ObjectCount().ToString() + " objects in Blender 3 file."); break; case Keys.S: blender.SaveBinaryBlenderObjects("blenderObject1.bin"); blender3.SaveBinaryBlenderObjects("xwing3.bin"); Blender xwing_with_normals = new Blender(); xwing_with_normals.ReadFile("xwing_with_normals.obj"); xwing_with_normals.SaveBinaryBlenderObjects("xwng_with_normals.bin"); break; } return result.ToString(); }
protected override void init() { blender = new Blender(); blender.ReadFile("test.obj"); blender.Scale(new Vector3(0.05f, 0.05f, 0.05f)); blender2 = new Blender(); blender2.ReadFile("test.obj"); blender2.SetColor(Colors.BLUE_COLOR); blender2.Scale(new Vector3(0.07f, 0.05f, 0.05f)); blender3 = new Blender(); blender3.ReadFile("X_Wing3.obj"); blender3.SetColor(Colors.WHITE_COLOR); blender3.Scale(new Vector3(0.1f, 0.1f, 0.1f)); credit1 = new TextClass("X-Wing Model based on Blender model by", 0.4f, 0.04f, staticText); credit1.SetOffset(new Vector3(-0.75f, -0.65f, 0.0f)); credit2 = new TextClass("Angel David Guzman of PixelOz Designs", 0.4f, 0.04f, staticText); credit2.SetOffset(new Vector3(-0.75f, -0.75f, 0.0f)); SetupDepthAndCull(); }
protected override void init() { ship = new Blender(); ship.ReadBinaryFile("xwng_with_normals.bin"); ship.SetColor(Colors.WHITE_COLOR); ship.Scale(currentScale); enemies = new List<Enemy>(); for (int i = 0; i < 10; i++) { Enemy enemy = new Enemy(); enemies.Add(enemy); } deadenembyText = new TextClass("Dead enemby = " + deadEnemyCount.ToString(), 0.4f, 0.04f, staticText); deadenembyText.SetOffset(new Vector3(-0.75f, +0.8f, 0.0f)); credit1 = new TextClass("X-Wing Model based on Blender model by", 0.4f, 0.04f, staticText); credit1.SetOffset(new Vector3(-0.75f, -0.65f, 0.0f)); credit2 = new TextClass("Angel David Guzman of PixelOz Designs", 0.4f, 0.04f, staticText); credit2.SetOffset(new Vector3(-0.75f, -0.75f, 0.0f)); SetupDepthAndCull(); SetupShaders(); }