private static void UnlockAnimation(GameWindow parent) { var infoBox = new InfoBox(parent, new Vector(200, 200), modelBank[UnlockedModels].unlockMessage); infoBox.Size.X = 250; infoBox.CanBeMoved = false; infoBox.Show(); var obj = new Object(); obj.Body = modelBank[UnlockedModels].model; //i know it's bad practice but since our camera is //always located at one point, it doesn't matter obj.Location = new Vector(0, 0, 0); obj.Body.Rotate = true; infoBox.OKClicked += (pos) => { parent.Children3D.Remove(obj); obj.Body.Rotate = false; Game.EndLevel(); }; infoBox.ExclamationClicked += (pos) => { parent.Add3DChildren(obj); }; }
private void Initialize() { StartingLocation = new Vector(0f, 0f, 0f); fObject = new FlyingObject(Parent, ModelManager.modelBank[0].model, 7); fObject.ShaderProgram = GeneralGraphics.SimulatedLighting; var physGui = new Object(); physGui.Location = new Vector(0f, 0f, 0f); PhysicsObject obj = new PhysicsObject(); obj.Velocity = fObject.PhysicalBody.Velocity; obj.ParentObject = physGui; for (int i = 0; i < 8; ++i) { obj.ModulatePhysics(); obj.ApplyNaturalForces(); } var target = new DecimalVector((decimal)physGui.Location.X, (decimal)physGui.Location.Y, (decimal)physGui.Location.Z + 10); Camera.MoveTo(target, 60); timer = new Timer(); timer.Interval = 10; timer.Tick += AnimationStep; timer.Start(); fObject.Start(); }
/// <summary> /// Initializes this class along with all the buttons and models. /// In general, this is a fairly slow process. /// </summary> /// <param name="parent">The parent of this control.</param> public IntroScene(GameWindow parent) { Parent = parent; arrow = new Object(); gun = new Object(); var temp = new OBJModel(); temp.Color = Color.LightGoldenrodYellow; temp.ParseOBJFile("data/models/arrow/arrow.obj"); temp.ScaleFactor = 1.5f; temp.Stroke = true; temp.Rotate = false; temp.RotationVector = new Vector(1.0f, 0.0f, 0.0f); arrow.Body = temp; arrow.Visible = false; arrow.Location = new Vector(-1.5f, -11.3f); temp = new OBJModel(); temp.ParseOBJFile("data/models/gun/gun.obj"); temp.ScaleFactor = 0.2f; temp.Rotate = true; temp.RotationVector = new Vector(0.0f, 0.0f, 1.0f); gun.Body = temp; gun.Visible = false; gun.Location = new Vector(9.5f, -5.3f, 3.0f); textControl = new Label(); textControl.Location = new Vector(20, 100); textControl.Text = ""; textControl.IgnoreSize = true; parent.Children.Add(textControl); timer = new Timer(); timer.Interval = 50; timer.Tick += (o, e) => { if (fadeOut < destFade) { fadeOut += 0.01f; return; } if (counter >= introText.Length) return; textControl.Text = textControl.Text + introText[counter++].ToString(); if (counter > 20 && introText[counter - 1] == '!') { arrow.Visible = true; gun.Visible = true; } }; skip = new Button(); skip.Text = "Skip/Continue"; skip.Location = new Vector(300, 500); skip.MouseClick += (pos) => { End(); Parent.State = Window.WindowState.Game; }; Parent.Children.Add(skip); Parent.Children3D.Add(this); Visible = false; skip.Visible = false; }